I am setting the source of an iframe to an html string as shown below to have it execute a string of html that I have stored in memory.
window.sHTML = html;
iframe.src = 'javascript:parent.sHTML';
The html string includes javascript code like this:
window.onerror = function(a,b,c) {
console.log(a);
console.log(b);
console.log(c)
return true;
}
When are error occurs in the iframe it logs "Script Error", "", "0" rather than giving me the actual error information.
I understand that this can happen when the iframe in question is cross domain: Cryptic "Script Error." reported in Javascript in Chrome and Firefox
However, the iframe is not cross domain, it is just something I created dynamically. Is there any way to make window.onerror treat it as a non-cross domain iframe so that I can access the proper error information from window.onerror?