Javascript IFrame Reload


SUBMITTED BY: Guest

DATE: March 16, 2014, 10:25 p.m.

FORMAT: Text only

SIZE: 1.0 kB

HITS: 957

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="pl" xml:lang="pl">
  3. <head>
  4. <title>Javascript IFrame Reload</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. <script type="text/javascript"><!--
  7. // set your interval in milliseconds
  8. var reloadInterval = 3000;
  9. // this will run when the document is fully loaded
  10. function init() {
  11. setTimeout('reload()',reloadInterval);
  12. }
  13. // this reloads the iframe, and triggers the next reload interval
  14. function reload() {
  15. var iframe = document.getElementById('reloader');
  16. if (!iframe) return false;
  17. iframe.src = iframe.src;
  18. setTimeout('reload()',reloadInterval);
  19. }
  20. // load the init() function when the page is fully loaded
  21. window.onload = init;
  22. --></script>
  23. </head>
  24. <body>
  25. <iframe id="reloader" width="500" height="400" src="http://www.google.com/"/>
  26. </body>
  27. </html>

comments powered by Disqus