473,804 Members | 3,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

iFrame with js src loads the first time, but throws error on reload...

Me
Hello,

The code below runs well on IE 6 and 7.

On Firefox it loads the first time but throws the following error on
reloads.
Error: top is not defined
Source File: top.myIFrameBod y();
Line: 1

On Mozilla it never works due to permissions not allowing access to
myIFramBody.

On Netscape 7.2 it loads the first time, but throws security errors
on reloads.

On Safari it throws this error:
TypeError - Value undefined (result of expression top.myIFrameBod y) is
not object. about:blank

At first I thought it was a caching problem per
http://developer.mozilla.org/en/docs...ox_1.5_caching

So I added:
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-STORE">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
but it made no difference.

Any ideas?

Thank you.

<html>
<head>
<script type="text/javascript">
myIFrameBody = function() {
var data = [
'<html><head>' ,
'</head><body>',
'Hello World: ',
Math.random(),
'</body></html>'
].join('\r\n');
return data;
}
</script>
</head>

<body>

<iframe src="javascript :top.myIFrameBo dy();" width="400"
height="50"></iframe>
<br>

</body>
</html>
Jan 10 '07 #1
1 2122
Me
I forgot to mention that it successfully loads and reloads on Opera 9,
but fails to load or reload on Opera 7 and 8.

Jan 10 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1638
by: Terry | last post by:
Hello, http://free.hostdepartment.com/j/javashop/this_works.htm http://free.hostdepartment.com/j/javashop/this_doesnot.htm Please take a look of the above two links. The two pages are almost identical. Each has a slide show, a image loading progress bar and a message scroller. The message scroller is done with an <iframe>.
2
2871
by: Jim | last post by:
I want to pass a value from the parent to the iframe when I click a button, the parent will reload and the iframe should show the data I need... when the iframe loads I want it to run something in asp based on the value I send it..how can I go about doing this? thanks -Jim
0
3821
by: Leslie McGann | last post by:
Hi, I need to open a different pdf file in an iframe each time the user clicks a button. I also need to open the pdf to a specific page each time. The pdfs in question are located on a web site/virtual directory on a different server. I'm using the RegisterStartupScript function to perform a redirect to the new pdf the first time the page is loaded and each time this button is clicked. The problem is that the pdf document only...
26
3265
by: shlomi.schwartz | last post by:
using this example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Test Page</title> </head>
6
11098
by: Bob | last post by:
Hi All, Is the following possible, and if so could someone show me some example code please :o) I have a web page with several iframes, and I want to be able to refresh them only not the entire web page but also to refresh them at different time intervals. I've tried a few ways but it ends up refreshing the entire page, doh. I've tried with DIV's and objects aswell but no joy, I'm sure it must be possible and I'm been a thicket ;o)
3
4490
by: PCgeek | last post by:
sorry moved this over to javascript forum, didn't mean to post 2x! Hi guys, I'm trying to put the finishing touches on my website and could really use some help on this particular issue. My page includes background music with a javascript music player on the main page below an iframe that is used for all content and navigation of the site and so that the music doesn't reload each time a page is switched. There is another javascript to resize...
2
12951
by: ericisjusteric | last post by:
I have a page with multiple iframes and need to have the user (ie6) be able to click a button to refresh any one of the iframes - but also to click another button at the top of the page to refresh all of them - from the server (this could be on page refresh also) as the purpose is to reset the iframe to the original content in case the user clicked on a link in that iframe and changed it, but also in case there were updates to the original page...
0
9704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10070
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2978
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.