JSFiddle - React, Tailwind, and code Playground
HTML
<iframe id=inner src="about:blank">
JavaScript
// Here, $wnd is an iframe of the current document;
// in GWT, script runs in the iframe and $wnd is the parent window.
var $wnd = document.getElementById('inner').contentWindow;
$wnd.document.write('<input type=file id=f>');
$wnd.document.getElementById('f').addEventListener('change', function(e) {
var file = e.target.files[0];
var f1 = new FileReader();
f1.onload = function() {
display('FileReader', f1.result);
var f2 = new $wnd.FileReader();
f2.onload = function() { display('$wnd.FileReader', f2.result); };
f2.readAsArrayBuffer(file);
};
f1.readAsArrayBuffer(file);
});
function display(s, a) {
document.body.appendChild(document.createElement('p'))
.appendChild(document.createTextNode("From " + s + ", instanceof ArrayBuffer: " + (a instanceof ArrayBuffer)));
document.body.appendChild(document.createElement('p'))
.appendChild(document.createTextNode("From " + s + ", instanceof $wnd.ArrayBuffer: " + (a instanceof $wnd.ArrayBuffer)));
}