Tech Support Websites

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Monday, 10 May 2010

HOW to continuously refresh any web-page in IE8 & FF

Posted on 06:14 by Unknown
Have you ever felt hassled by a website that provides continuous updates (like cricket scores or live event updates) but requires you to reload the page manually? While Opera browser has an option to automatically reload a web page at pre-defined intervals, Internet Explorer, Firefox & Safari do not have any such feature by default.

I found this code for a browser bookmarklet to automatically refresh any web-page in IE on StackOverlow-

javascript:( function(){ i=0;setInterval("i++;var x=new ActiveXObject('Microsoft.XMLHTTP');
x.open('GET',location.href+'?'+i,true);x.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
x.onreadystatechange=function(){if(x.readyState==4)
{document.body.innerHTML=x.responseText;}};
x.send(null);",5000); }() )


I made the following minor change to it by replacing the use of Microsoft.XMLHTTP ActiveXObject with XMLHttpRequest object so that it works in all new browsers -

javascript:( function(){ i=0;setInterval("i++;var x=new XMLHttpRequest();
x.open('GET',location.href+'?'+i,true);x.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
x.onreadystatechange=function(){if(x.readyState==4)
{document.body.innerHTML=x.responseText;}};
x.send(null);",5000); }() )


Note that in the code snippets I have added newline characters for readability & formatting. Make sure you remove the newline characters so that the whole code is on just one line. The code uses a JavaScript Timer to refresh the page every 5 seconds or 5000 milli-seconds. Change it to set an interval of your choice.

To add the bookmarklet in Firefox, enable the Bookmarks Toolbar (View > Toolbars > Bookmarks Toolbar). Right click on the Bookmarks Toolbar & select New Bookmark. In the Add Bookmark dialog box that opens, type "Refresh Page" as the name of the bookmarklet & paste the second code snippet that's above into the Location textbox as shown in the screenshot below.


A good way to share Bookmarklets (like the jQuerify Bookmarklet or these popular Bookmarklets) is to host it on a webpage as hyperlinks. I could not find a way to embed it on a webpage as a hyperlink (because the code involves using nested quotes) nor a clean way to add the above Bookmarklet to the Favorites Bar in IE8. The following steps to add the Bookmarklet though a little clumsy, get the job done -
1. With the Favorites Bar (View > Toolbars > Favorites bar) open, add any webpage from the tabs as a Favorite.
2. Right click on that Favorite in the Favorites Bar & select Properties from the context menu.
3. In the URL text box of the Web document tab, add the Bookmarklet code shown above


4. A warning "The protocol 'javascript' does not have a registered program. Do you want to keep this target anyway?" appears. Click on the "Yes" button
5. Go to the General tab & type the name for the Bookmarklet as "Refresh Page"


Now whenever you need a webpage to be reloaded automatically, click on the Bookmarklet while you have that page open.

I've tested the Bookmarklet for a short while with Google News. Please report if you find any issues with the Bookmarklet or any other feedback that you may have.

Also see:
View Selection Source in IE
.120
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in Browsers, HOWTO, IE | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Windows 8 keyboard shortcuts
    Win + X   - context menu to access common features like Control Panel, Task Manager, File Explorer, Programs & Features, Run, Search etc...
  • My 30-day personal project - watch 100 hours of Pluralsight videos
    Inspired by Matt Cutts' 30-day challenges , I plan to watch 100 hours of Pluralsight online videos to get up-to-date with current ...
  • Archive tweets & favorites with Google Reader
    There are numerous ways to archive tweets but rather than use yet another tool, I prefer using Google Reader to preserve the tweets I mark ...
  • Azure in Pictures - overview of Windows Azure Features, Services and Common Uses
    Download the Windows Azure Poster in PDF format (1.1MB)
  • 10 ways to make laptop battery last longer
    Paraphrased from a Right Choice magazine article with my own opinions: Keep the brightness of the screen as low as possible. If portability ...
  • What is the difference between Browser Mode & Document Mode in IE
    If you're a web developer and your job actively involves building web pages that work the same in all browsers including the last three ...
  • India ranks fourth in Internet usage
    Deepak Shenoy informs that as per Telecom Regulatory Authority of India (TRAI) data, India has nearly 10 million Broadband connections in ...
  • Dashboard-like info with Browser tabs, Windows 7 Taskbar tabs
    Browser tabs & Windows 7 Taskbar tabs are turning self-aware.  This is how my browser looked the other day: I had the summary of all tha...
  • What's common between Kovid Goyal & Antony Lewis?
    Kovid Goyal Antony Lewis They are both PhDs in Physics and creators of free software applications that have been downloaded by millions. Kov...
  • HOW TO let Google watch over your web activity
    When we get onto the Internet, we trade our privacy for convenience. Everyone from marketers, ISPs to Governments can watch our activities o...

Categories

  • AJAX
  • Android
  • APIs
  • App
  • ASP
  • ASP.NET
  • ASP.NET-MVC
  • Azure
  • Azure SQL Database
  • AzureInPictures
  • Bing
  • Book Review
  • Bookmarklet
  • Browsers
  • C#
  • chart
  • Chrome
  • Cloud
  • CSS
  • CSS3
  • DidYouKnow
  • E-Commerce
  • Excel
  • FB
  • Fiddler
  • Firefox
  • Gadgets
  • GeoLocation
  • GMail
  • Google
  • Google Docs
  • Google Reader
  • Health
  • Hotmail
  • HOWTO
  • HTML
  • HTML/CSS
  • HTML5
  • Humor
  • Hyderabad
  • IE
  • IIS
  • India
  • Internet
  • IT
  • Javascript
  • jQuery
  • JSON
  • JSONP
  • Laptop
  • Learning Resources
  • Lists
  • Map
  • Metrics
  • Microsoft
  • miscellaneous
  • Mobile
  • NAPA
  • Office365
  • Opera
  • PDF
  • Performance
  • Personal
  • PHP
  • PM
  • PowerShell
  • Privacy
  • Programming
  • Rant
  • Safari
  • Science
  • Search Engines
  • SearchEngines
  • Security
  • SEO
  • Sharepoint
  • SharePoint2013
  • Silverlight
  • Software Engineering
  • Solutions
  • SQL Azure
  • SQL Server
  • TFS
  • Tip
  • Tips
  • Tools
  • Tools/Utilities
  • Trivia
  • TWIL
  • Twitter
  • UX
  • VM
  • VS.NET
  • VS2010
  • VS2012
  • WCF
  • WebApps
  • Websites
  • WF
  • Windows Phone
  • Windows7
  • Windows8
  • Word
  • WP7
  • WPF

Blog Archive

  • ►  2013 (112)
    • ►  October (16)
    • ►  September (14)
    • ►  August (8)
    • ►  July (8)
    • ►  June (13)
    • ►  May (12)
    • ►  April (12)
    • ►  March (8)
    • ►  February (15)
    • ►  January (6)
  • ►  2012 (127)
    • ►  December (11)
    • ►  November (14)
    • ►  October (13)
    • ►  September (14)
    • ►  August (16)
    • ►  July (16)
    • ►  June (6)
    • ►  May (5)
    • ►  April (11)
    • ►  March (12)
    • ►  February (7)
    • ►  January (2)
  • ►  2011 (98)
    • ►  December (5)
    • ►  November (2)
    • ►  October (5)
    • ►  September (7)
    • ►  August (7)
    • ►  July (15)
    • ►  June (10)
    • ►  May (7)
    • ►  April (8)
    • ►  March (10)
    • ►  February (11)
    • ►  January (11)
  • ▼  2010 (163)
    • ►  December (14)
    • ►  November (19)
    • ►  October (19)
    • ►  September (15)
    • ►  August (18)
    • ►  July (17)
    • ►  June (20)
    • ▼  May (17)
      • 2 Free Scrum ebooks & a Checklist
      • IRCTC Alternatives
      • Book Review: Learning jQuery 1.3
      • Page Speed or YSlow
      • Google Doodle Pacman game available online/offline
      • What is the difference between R2 & SP?
      • Twitter For Dummies
      • jQuery is now on W3Schools
      • Free MSPress eBook on VS 2010
      • jQuery, Cloud Computing, Sharepoint 2010 sessions ...
      • Tips on working with remote development teams
      • Google Translate can now SPEAK Hindi
      • HOW to continuously refresh any web-page in IE8 & FF
      • Raman Effect can fingerprint the universe
      • Web Security Tutorials from Google & MS
      • Collaborative JavaScript debugging tools - jsFiddl...
      • Learning Resources on Computers & Programming for ...
    • ►  April (19)
    • ►  March (5)
Powered by Blogger.

About Me

Unknown
View my complete profile