473,569 Members | 2,916 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

refreshing the window or iframe without click sound

258 Contributor
Here you can see the script I found in google to refresh a page without hearing any click sound which is usual to hear when a link is clicked or a page is refreshed.

Expand|Select|Wrap|Line Numbers
  1.  
  2. <script type="text/javascript" >
  3. window.onload = doLoad;
  4.  
  5. function doLoad()
  6. {
  7. setTimeout( "refresh()", 5*1000 );
  8. }
  9.  
  10. function refresh()
  11. {
  12. window.location.reload( false );
  13. }
  14. </script>
  15.  
  16.  
I have a PHP page which needs to refresh every 5 seconds. Actualy this JAVA script works fine without any problem

BUT
the problem i'm thinking about is that if the server does not respond (just once) as it happends sometimes the page will not be loaded again and if the page is not loaded it will not get refreshed anymore...

SO
I was thinking to put an IFRAME inside the main page and refresh it from the main page.. So even if server doesn't respond once, page will not stop refreshing and it may take another 5 seconds to refresh

This script refreshes the current window but unfortunately i dont know anything about JAVA and the only thing i do is to copy and past this script inside my page between HEAD tags... I'll be thankful if anyone help me refresh an IFRAME with this script ( whitout any click sound )
Sep 20 '07 #1
6 5130
acoder
16,027 Recognized Expert Moderator MVP
Try:
Expand|Select|Wrap|Line Numbers
  1. document.frames['iFrameName'].location.reload();
Sep 20 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
Added "or iframe" to the thread title.
Sep 20 '07 #3
bnashenas1984
258 Contributor
Thanks for the help
But the script is not working with Mozilla. The old one worked with both Mozilla and IE but this one is only working in IE

Here is the new one

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4.  
  5. <script type="text/javascript" >
  6. document.frames['myframe'].onLoad = doLoad();
  7.  
  8. function doLoad()
  9. {
  10. setTimeout( "refresh()", 1*1000 );
  11. }
  12.  
  13. function refresh()
  14. {
  15. document.frames['myframe'].location.reload( false );
  16. }
  17. </script>
  18.  
  19. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  20. <title>Untitled Document</title>
  21. </head>
  22.  
  23. <body>
  24. <iframe name="myframe" id="myframe" frameborder="0" src="1.php" width="100" height="100" onload="doLoad();"></iframe><br />
  25. </body>
  26.  
  27. </html>
  28.  
  29.  
Sep 20 '07 #4
acoder
16,027 Recognized Expert Moderator MVP
OK, that should be window.frames[] or just frames[].

onLoad should be onload.

You should get an error on the line which tries to access the iframe before it has appeared. Put that statement into body/window onload.
Sep 20 '07 #5
bnashenas1984
258 Contributor
As you said I changed window.frames['myframe'] to frames['myframe'] and its working now ( both with IE and Mozilla )

Thank youuuuuuuuuu

That was a big help. I wish some day i'll be an expert like you guys and help others..
Sep 20 '07 #6
acoder
16,027 Recognized Expert Moderator MVP
You're welcome.

Keep trying. Everyone's learning all the time no matter how much of an expert they are.
Sep 21 '07 #7

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

Similar topics

3
4682
by: Seansan | last post by:
Hi, Does anyone know how I can disable the click sound that is heard when a IFRAME is reloaded? I use javascript to reload an IFRAME every minute or so and I keep hearing this "click". thx in advance, Seansan
1
2019
by: Jennyfer J Barco | last post by:
Hello I have a datagrid and a linkbuttom in the datagrid that says Picture, every time I click on the link "Picture" my program opens a popup window showing a picture of the item the selected and information about the item. On the html of the datagrid I have the following: OnItemCommand="Grid_CartCommand" OnItemCreated="DataGrid_ItemCreated"....
18
3311
by: len.hartley | last post by:
Hi, I am trying to pop-up a window when the user clicks on an image. The problem is that when the user clicks on the image and the window pops up OK, but the window underneath also proceeds to the image. The desired behavior is that when the pop-up is invoked, I want the underlying window to stay put. I don't have this problem when I...
1
2040
by: asamchristopher | last post by:
hi.. i am having a iframe inside a page. In iframe , i have some options, by according to the selection an option, i want to refresh the entire parent window .. say for eg: i am having some userid's inside my iframe. By selecting a userid and i click the edit button.. the whole parent window should by refreshed with the edit page of the user...
13
7435
by: honey99 | last post by:
Hi! I have to fix a problem in JSP.Actually,i have a JSP page say Ex1.jsp.In this Ex1.jsp i have an anchor tag which links into another JSP page i.e when i click on the link another pop-up window will open.My problem is the pop-up window and the parent window has same combobox.if i add data through html form in pop-up window(Ex2.jsp) it enters...
0
2053
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in a dialog box ended up opening up a new browser window with the aspx page, I read on a forum that I should use the iframe control and since I have...
1
9389
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in a dialog box ended up opening up a new browser window with the aspx page, I read on a forum that I should use the iframe control and since I have...
1
2943
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...
0
7693
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...
0
7605
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...
0
8118
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...
0
7962
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...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
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...
0
5217
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...
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
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...

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.