Forum Moderators: open

Message Too Old, No Replies

load directly into an iframe

         

th1chsn

4:21 pm on Jan 15, 2008 (gmt 0)

10+ Year Member



I have code on my site that takes any link on the site loads a page directly into an iframe. It allows me to create links like page.php?link.php and have that page show up in the iframe.

It works fine in Firefox but when I load the page in IE6 I get an error that says:

windows.frames.creative is null or not an object.


<script type="text/javascript">
function loadIframe(){
if (location.search.length > 0){
url = unescape(location.search.substring(1))
window.frames["creative"].location=url
}
}
onload=loadIframe
</script>

Does anyone know what the problem might be?

gergoe

7:32 pm on Jan 18, 2008 (gmt 0)

10+ Year Member



It is not clear to me why you have chosen to work with iframes and fill their content from an onload function with javascript, while you could simple set the src parameter of the iframe from your script.

Besides of that I don't see any reason why it does work in one browser, and not in the other (well, actually that's quite normal/common), you can try things like referencing your iframe using its id, instead of accessing the window.frames, or reviewing the way your script is executed, and make sure it is not executed before the iframe is displayed, or make sure you set both the name and id attribute of the iframe to make sure all browser will find it one way or another.