473,700 Members | 2,497 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!

[HTML]<html>
<head>

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

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

<iframe id="iframe2" height="200" width="900"
src="http://google.com"></iframe>
<br>
<input type="button" value="Reload Original CSI Content" onclick="Reload ();">
</body>
</html>[/HTML]
Jan 25 '08 #1
2 12849
gits
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');
  3.  
  4.     for (var i = 0, f; f = f_list[i]; i++) {
  5.         f.src = f.src;
  6.     }
  7. }
kind regards
Jan 25 '08 #2
ericisjusteric
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

0
6073
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 would expect the first DIV (including the IFRAME and IMG) two be rendered above the second DIV....
2
12491
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 will contain a jpeg of a scanned document which comes from y.mydomain.com/somelocation/file.jpg....
0
2181
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 dialog. It fails with IFrames. What needs to change now that I have replaced the frameset with...
1
2673
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 in the code-behind, how do I call the SaveGrid procedures I've written on each of the iframe pages...
1
3048
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 would ideally like everything to be done in this page, and not in their pages). ...
3
4391
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 {
4
3194
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 in the previous page. Both iframes are loaded when arriving to the page, but only one is shown. ...
0
8731
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
9219
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
9081
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...
1
8975
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,...
1
6564
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
5904
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
4660
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2032
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.