javascript - iframe contentDocument: Access is denied -


the following code runs part of bookmarklet. creates iframe , tries access iframe.

for sites on ie (tried ie 10) fails access denied

iframedoc = i.contentdocument || i.contentwindow.document;  

i've put call inside setinterval, seemed work sites. apparently needed bit of time.

an example of site not work this site

var i=document.createelement('iframe'); i.setattribute('id', 'my_id'); i.setattribute('name', 'my_name'); document.body.appendchild(i);   var intervalid = setinterval( function(){     try{         var iframedoc = i.contentdocument || i.contentwindow.document;         clearinterval(intervalid);         alert("success!");     } catch(e){} }, 10 ); 

i need access in order attach form , script submits form. i've tried adding them iframe before adding iframe body, not work.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -