JSFiddle - React, Tailwind, and code Playground
HTML
<iframe id="ifr" src="http://example.com"></iframe>
<iframe id="ifr2" src="about:blank"></iframe>
JavaScript
function checkIframe( ifr ) {
var key = (+new Date) + "" + Math.random();
try {
var global = ifr.contentWindow;
global[key] = "asd";
return global[key] === "asd";
}
catch(e){
return false;
}
}
$(function() {
alert( checkIframe( $("#ifr")[0] ) +""+ checkIframe( $("#ifr2")[0] ) );
});