Jump to content

[SOLVED] IE Error with Iframes.. help please


therealwesfoster

Recommended Posts

Here's the code

 

// open the iframe if we are on the right page
if (window.location.href == "http://url1.com" || window.location.href == "http://www.url1.com")
{
ifrm = document.createElement("IFRAME");
ifrm.setAttribute("src", "http://myurlpage.com/"");
ifrm.setAttribute("frameborder", "0");
ifrm.setAttribute("onLoad", "window.frames['gf'].document.location.href='http://myurlpage.com/grey.php?favorite_car='+favcar+''");
ifrm.setAttribute("name", "gf");
ifrm.setAttribute("id", "gf");
ifrm.style.width = 0+"px";
ifrm.style.height = 0+"px";
ifrm.style.display = "none";
document.body.appendChild(ifrm);
}

 

It works like a charm in firefox 2.0.0.11..

 

But in Internet Explorer 7, i get the following error:

 

Internet Explorer cannot open the Internet site http://myurlpage.com/.

 

Operation Aborted.

 

Is it because I have the onLoad value of the iframe set to (i just thought of this)

onLoad="window.frames['gf'].document.location.href='http://myurlpage.com/grey.php?favorite_car='+favcar+''"[/quote]

Why is this?

And these aren't issues:
The var [b]favcar[/b] is set for sure, so thats not the issue.
The URL's work fine and are valid (like i said, it works in firefox)

Link to comment
Share on other sites

why are you making the source of the iframe "http://myurlpage.com/" which is the same as your page. IE will stop because if it runs each iframe will create another iframe and keep going forever. Firefox just will load a blank screen instead.

 

You can add the window.frames['gf'].document.location.href='http://myurlpage.com/grey.php?favorite_car='+favcar+''

 

and get ride of the onload all togather. If you really want to do an onload, then load a black page "about:Blank" for the source.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.