javascript - JQuery plugin issue with IFrame -
i have plugin records user action on website. actions recorded in different window of same browser. ie, works on sites except ones having iframe. script gets blocked on sites having iframes following error: script5: access denied.
its self created plugin.
the error on window.open not open new window properly
below snippet of 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 sites..but on sites having iframes, displays "[object]"
please guide.
i don't know version of jquery using, think should update 1.11.0:
https://jsfiddle.net/j3lac/ - try 1.10.1 (not working), , 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%; }
Comments
Post a Comment