Very Urgent: Please help me to solve this problem.

Discussion in 'JavaScript' started by tamilsoft, Jun 12, 2007.

  1. #1
    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.
     
    tamilsoft, Jun 12, 2007 IP
  2. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #2
    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):
     
    ajsa52, Jun 12, 2007 IP
  3. tamilsoft

    tamilsoft Banned

    Messages:
    1,155
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yeah, It's working now, Thankzz
     
    tamilsoft, Jun 12, 2007 IP