472,347 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,347 software developers and data experts.

refreshing the window or iframe without click sound

258 100+
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 5031
acoder
16,027 Expert Mod 8TB
Try:
Expand|Select|Wrap|Line Numbers
  1. document.frames['iFrameName'].location.reload();
Sep 20 '07 #2
acoder
16,027 Expert Mod 8TB
Added "or iframe" to the thread title.
Sep 20 '07 #3
bnashenas1984
258 100+
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 Expert Mod 8TB
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 100+
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 Expert Mod 8TB
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
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...
1
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...
18
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...
1
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...
13
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...
0
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...
1
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...
1
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...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

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.