www.webdeveloper.com
Results 1 to 4 of 4

Thread: Auto-refresh page using nothing by javascript in URL

  1. #1
    Join Date
    Mar 2012
    Posts
    2

    Auto-refresh page using nothing by javascript in URL

    Just what the title says. I've tried this a number of ways, and either it doesn't work (doesn't do anything) or refreshed the page and changes the URL with it so the timer never goes off again to refresh the page.

    I would even accept writing this as a FF plugin if necessary, BUT it would have to be short, as I have to manually type out the code as the system is segmented from all media and internet.

    I need a page, that normally times out after 10 minutes, to refresh as if the user hit the refresh button.

  2. #2
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,636
    open the page in an iframe and then refresh it as fast and many times as you like
    xxx: Guess Buddhist riddle: "What is the sound of one hand clapping?"
    yyy: facepalm

  3. #3
    Join Date
    Mar 2012
    Posts
    2
    Quote Originally Posted by Padonak View Post
    open the page in an iframe and then refresh it as fast and many times as you like
    Sample code please?

  4. #4
    Join Date
    Apr 2010
    Location
    Oslo, Norway
    Posts
    89
    There might be some security-issues with this, but it should work.

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <title>Reload iframe demo</title>
    <script type="text/javascript">
    	var reloadInterval;
    	var url='http://www.w3schools.com/tags/tag_iframe.asp';
    	var reload_time_in_seconds=10;
    
    	function reloadFrame(id){
    		document.getElementById(id).src=url;
    		console.log("interval triggered");
    	}
    	function initiateInterval(id){
    		document.getElementById(id).src=url;
    		reloadInterval=setInterval("reloadFrame("+id+")",reload_time_in_seconds*1000);
    	}
    	
    </script>
    </head>
    <body id="body" onload="initiateInterval('myframe')">
    <iframe height="600" width="100%" id="myframe" ></iframe>
    </body>
    </html>
    Good luck
    - Spinner
    Producer, Developer, Gamer, Father and Husband.

    Spinners Web-development blog

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles