Excel as a Test Management Tool

Because you're going to use it anyway...

Ruby-Selenium Webdriver

In under 10 Minutes

%w or %W? Secrets revealed!

Delimited Input discussed in depth.

Managing Knowledge Transfer Sessions

Read the article, grab the templates

Ask questions

If you don't ask, you won't learn. You won't teach either.

Tuesday, 18 November 2014

Auto-refresh a web page

Today I discovered the main website I keep at www.cyreath.co.uk wasn't live. Shockfest! I say the main site, but it's the main 'static' site, the main site is perhaps the blog over at http://cyreath.blogspot.co.uk now. Either way, the website was (is) down and I'm waiting for support to email it's back up.

The email will be appreciated but just trying to load the site is the best way to know it's there. What I don't want to do is keep hitting F5 though. Thankfully HTML has the reload() method available. Wrapped in a little JavaScript we can use this to poll the site and avoid having to refresh it ourselves.

The script is pretty straight forward and useful for other things. You can plug in that auction site, page with a hit counter, flight status or test results dashboard page showing on a large screen in the office.

Paste the below into your favourite text editor and save it as a .html page.


 <html>  
      <head>  
           <script type="text/JavaScript">  
                <!--  
                function pageCheckRefresh(timeoutPeriod) {  
                     setTimeout("location.reload(true);",timeoutPeriod);  
                }  
                //  -->  
           </script>  
      </head>  
      <!--- change this to the refresh time you want -->  
      <body onload="JavaScript:pageCheckRefresh(10000);">  
           <!--- This first url is just a control, one we know WILL be there, so we know this checker is working -->  
           <p><iframe height="200" width="750" src="http://www.bbc.co.uk"></iframe></p>  
           <!--- You can have more pages in iframes, just copy the below ( <p> to </p> ) -->  
           <p><iframe height="300" width="750" src="http://www.cyreath.co.uk"></iframe></p>  
      </body>  
 </html>  

You'll need to edit two things and add one:

Edit the refresh
It's currently set to 10000, which is 10 seconds.

Edit the target URL
Change http://www.cyreath.co.uk to the URL you're interested in.

Add additional URLs
Copy and paste the ...
section and add another URL to check multiple pages.

That's it, straight forward but handy.

Mark.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Liked this post?

Say thanks by clicking an Ad

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~