I have a plugin which records user action on any website. The actions are recorded in a different window of the same browser. For IE, it works properly on all sites except the ones having Iframe. The script gets blocked on the sites having Iframes with the following error: SCRIPT5: Access is denied.
Its a self created plugin.
The error is on window.open It does not open a new window properly
Below is the snippet of the plugin.
newwindow = window.open("", "ScriptGen", "menubar=0,directories=0,toolbar=no,location=no,resizable=yes,scrollbars=yes,width=450,height=250,titlebar=0");
newwindow.document.write('<title>New Console</title>');
Using alert(window) displays "[object Window] on all sites..but on sites having iframes, it displays only "[object]"
Please guide.
I don't know what version of jQuery are you using, but I think you should update to 1.11.0:
https://jsfiddle.net/j3LaC/ - try this with 1.10.1 (not working), and with 1.11.0 (working)
HTML:
<div id="body"></div>
<input id="button" type="button" value="Submit iframe"/>
JavaScript:
var iframe = $("<iframe></iframe>").appendTo("#body")[0];
var doc = iframe.document;
var content = '<form method="get"><input name="hidden" type="hidden" value="123"/></form>';
doc = iframe.contentDocument;
doc.writeln(content);
doc.close();
$('input#button').click(function () {
$('iframe').contents().find('form')[0].submit();
});
CSS:
iframe {
height: 300px;
width : 100%;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With