Hi, I got the follwing error,while creating a dynamic iframe with remote url using javascript. "Internet Explorer cannot open the Internet Site www.mydomain.com Operation Aborted"; Here is My Code: var iframe = document.createElement("iframe"); iframe.setAttribute("src", "http://www.someotherdomain.com/test.html"); iframe.setAttribute("scrolling", "no"); iframe.setAttribute("frameBorder", "0"); iframe.setAttribute("height","400"); iframe.setAttribute("width","300"); document.body.appendChild(iframe); Please help me to overcome this.
You need to execute your code after the load of your page: Fill that code on a function called after load, so: (Tested only on FireFox). <html> <head> <script type="text/javascript"> function f_create() { var iframe = document.createElement("iframe"); iframe.setAttribute("src", "http://www.someotherdomain.com/test.html"); iframe.setAttribute("scrolling", "no"); iframe.setAttribute("frameBorder", "0"); iframe.setAttribute("height","400"); iframe.setAttribute("width","300"); document.body.appendChild(iframe); } </script> </head> <body onLoad="f_create();"> hello </body> </html> Code (markup):