473,748 Members | 2,276 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Refresh iframe

How do I refresh an iframe via JavaScript from the parent page?

/Jacob

Mar 15 '06 #1
5 178997

Jacob wrote:
How do I refresh an iframe via JavaScript from the parent page?

/Jacob


<html>
<head>
<script type="text/javascript">

function Reload () {
var f = document.getEle mentById('ifram e1');
f.src = f.src;
}

</script>
</head>
<body>
<iframe id="iframe1" height="200" width="300"
src="http://google.com"></iframe>
<br>
<input type="button" value="Reload" onclick="Reload ();">
</body>
</html>

Mar 15 '06 #2
Is there no way to use location.refres h or location.reload ?

/Jacob

Mar 15 '06 #3

Jacob wrote:
Is there no way to use location.refres h or location.reload ?

/Jacob


var f = document.getEle mentById('ifram e1');
f.contentWindow .location.reloa d(true);

Value of parameter in the brackets :

false - Default. Reloads the page from the browser cache.
true - Reloads the page from the server.

But I don't know whether it works elsewere besides IE.

Mar 15 '06 #4
Jacob wrote:
How do I refresh an iframe via JavaScript from the parent page?


window.frames[...].reload(...);

Might not be pretty, is completely proprietary, but it works always.
Even with different second-level domains.
PointedEars
Mar 16 '06 #5
marss wrote:
Jacob wrote:
Is there no way to use location.refres h or location.reload ?


var f = document.getEle mentById('ifram e1');
f.contentWindow .location.reloa d(true);

Value of parameter in the brackets :

false - Default. Reloads the page from the browser cache.
true - Reloads the page from the server.

But I don't know whether it works elsewere besides IE.


It also works in Gecko, in fact the Location object and its reload()
method (along with the meaning of the argument) were introduced in
NN 3.0 (JavaScript 1.0 then). However, this solution has its
shortcomings:

- it requires implementation of HTMLDocument::g etElementById()
(not before IE 5.0)
- it requires an ID for the `iframe' element,
(or implementation of HTMLDocument::g etElementsByTag Name();
not before IE 5.0)
- it requires support of the `contentWindow' property
(not before IE 5.5)

DOM Level 0 suffices here, works _always_ and most certainly _everywhere_
(except if client-side script support is unavailable).
PointedEars
Mar 16 '06 #6

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

Similar topics

0
3337
by: Conax | last post by:
Hi, It's me again asking about IFRAME. With UncleWobby, Steven Burn and Roland Hall's help, I was able to create a proper IFRAME section on my page. Now I come to the next problem. I'd like to be able to:
0
2171
by: nick | last post by:
In the following link, the screen has a lot of refresh (iframe keep relocate its position ) when the mouse hover around the popup menu. But IE doesn't have the problem. http://greywolfdesign.com/tmp/projects/sylvan%20way/ProjSylvan.htm The flashing doesn't occur after I remove the iframe in the html code. Any clue?
2
23506
by: Jeronimo Bertran | last post by:
Hi, I have a page with a very data intensive grid which needs to be automatically refreshed constantly if a change is detected. In order to not refresh the complete page so often, I created an iframe on my page whose html has the refresh meta as follows : <meta http-equiv="refresh" content="10"> The iframe is effectivelyh refreshed every 10 seconds without having the
21
6156
by: javainfo | last post by:
How can i refresh IFRAME and load data through AJAX?
0
2043
by: Abhishek Srivastava | last post by:
Hello Everyone, I have two files. File 1 is called HTMLPage.html. The content of this file is <html><head><meta http-equiv='refresh' content='1' /></head><body><table><tr><td>0/0</tr></td></table></body></html> If I view this file in IE, as expected the browser refreshes itself every 1 sec.
1
7986
by: spolsky | last post by:
hi, i have the following pages. when form submitted with the field1 value is "ok" then the iframe must be loaded with the text "Page loaded...". This works fine with IE 6 and FireFox(1.5) but Opera (9.01) does not refresh the iframe and loads the page for iframe from the cache, so refreshing the page gets the iframe refreshed with the new page. If DisableCaching() function used which disables all kind of caching then Opera works fine. So,...
1
3461
by: epower | last post by:
Hello, I am working on an ASP .NET application in Visual Studio 2005 and running IE7. This application has a page that contains an iframe which loads an .aspx page and hyperlinks that load the iframe with different .aspx pages. The HTML/mark up for the .aspx pages executes every time, but the Page_Load events for the pages never run (on initial load or subsequent loads).
1
2954
by: bnashenas1984 | last post by:
Hi everyone I'v seen several websites doing what I'm asking now but I don't know how they do it. Lets say we have an E-commerce website that has a shopping cart inside an IFrame which shows what products have been added. Users should be able to add comments for each product inside the shopping cart (in the Iframe) . When the user clicks on the product a new popup window opens which allows him to add the comment and then save. But...
0
8995
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...
1
9331
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9253
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
6798
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
6077
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
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...
1
3316
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
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2216
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.