473,550 Members | 2,673 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reload iframe for individual and all iframes on page

2 New Member
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 since the last load. The page hosting the iframes is in a frameset.

I used the following code from an older thread but (as I don't know javascript) when I modified it to include two iframes for a test it didn't work. It refloads only the first iframe when clicking either button. Reloading the whole page doesn't reload the iframes if they have been changed, and I need that (again, from the server), too.

This needs to be manual reloading as the info in the iframe may be in use at any moment and I can't have it vanish unexpectedly even for a few seconds.

Also, is there any way to block break out of frames code for an iframe?

Your help is much appreciated!


<script type="text/javascript">
function Reload () {
var f = document.getEle mentById('ifram e1','iframe2');
f.src = f.src;

<iframe id="iframe1" height="200" width="900"
<input type="button" value="Reload Original CSI Content" onclick="Reload ();">

<iframe id="iframe2" height="200" width="900"
<input type="button" value="Reload Original CSI Content" onclick="Reload ();">
Jan 25 '08 #1
2 12724
5,390 Recognized Expert Moderator Expert
hi ...

use something like the following instead. this will reload all iframes in your page.

Expand|Select|Wrap|Line Numbers
  1. function reload_iframes() {
  2.     var f_list = document.getElementsByTagName('iframe');
  4.     for (var i = 0, f; f = f_list[i]; i++) {
  5.         f.src = f.src;
  6.     }
  7. }
kind regards
Jan 25 '08 #2
2 New Member
I tried what you suggested, pasting it in the head section and it didnt reload the iframes when I used the browser reload button. I did different search terms in the google.com iframes and expected that the original blank would be reloaded in both iframes, but it came back with the same two pages of search results. What am I missing?

Again, I would especially like a button that would reload all the iframes on the page from the server, and without reloading the page itself.

Also, if you know a way to block break out of frames for iframes, this has been a problem with the page. Alternately, to disable javascript in pages in iframes only.
Jan 26 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Martin | last post by:
I understand that as of IE5.5 iframes respect the z-index style property. However I have noticed some odd behaviour when the iframe's src is set to an MHT web archive instead of an HTML file. For example: I have a DIV containing an IFRAME and an IMG, whose z-index is 1. I have a second, identical DIV except this one's z-index is set to 0. I...
by: nightstar | last post by:
I am creating a web page that will contain multiple Iframes. One of the Iframes will contain a bill of sale that is generated by a script on x.mydomain.com/somefile.php?someparameters. One of the Iframes will contain a PDF of a multiple page scanned document (this iframe can be printed via the acrobat reader print button). The other iframes...
by: Guadala Harry | last post by:
I have an aspx page that opens as a modal dialog. The aspx contains two IFrames (ID = thumbFrame and mainFrame). From the code-behind of the page that loads in mainFrame I want to cause the page that appears in thumbFrame to reload. I have the following code that works fine with a normal frameset (no IFrames) that is NOT opened as a modal...
by: user | last post by:
I have a parent aspx page with a few iframes. Each of the iframes show an aspx page with a datagrid whose rows all show editable entry fields at all times. The user can enter values into the parent page's form and into the iframes' datagrids and then press a save button on the parent page. My question is: from the parent's Save_Click event...
by: knkk | last post by:
Hi, I have an iframe that fetches content from a different domain. This is my URL, which has an iframe that fetches content from another site careerbuilder.co.in (this is a partnership channel, so they will co-operate if there are small things they need to do in their code, like putting something in the body tag or adding some script, though I...
by: smartphreak | last post by:
not sure if this is the right forum but i will try explain myself. lets start by giving the code <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>TITLE</title> <script type="text/javascript" src="loadiframes.js"></script> <style type="text/css"> body {
by: raymon | last post by:
Hi, I have a page with two iframes that load content from another website. Only one of the iframes is shown at a time, depending on which tab the user is viewing. If user clicks on tab A, he will see iframe A. Same for tab B. Users arrive to the page via POST. Sometimes they see iframe A, sometimes they see iframe B, depending on the inputs...
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...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
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. ...
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...
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...
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...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
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...

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.