JSFiddle - React, Tailwind, and code Playground

HTML

<button type="button">Click me!</button>

JavaScript

var button = document.getElementsByTagName('button')[0];
button.addEventListener('click', function() {
    var win = open('', 'name', 'height=300, width=300'),
        iframe = document.createElement('iframe'),
        title = document.createElement('title'),
        file = new Blob(['test data'], { type: 'text/plain' }),
        fileUrl = URL.createObjectURL(file);
    
    title.appendChild(document.createTextNode('Nice title :)'));
    
    iframe.src = fileUrl;
    iframe.width = '100%';
    iframe.height = '100%';
    iframe.style.border = 'none';
    
    win.document.head.appendChild(title);
    win.document.body.appendChild(iframe);
    win.document.body.style.margin = 0;
}, false);