Tuesday, October 12, 2010

Webstuff: redirecting or refreshing a page of HTML

OK, you probably don't need to do this but I bet you've seen it done - you go to a website and suddenly - either immediately or a few seconds later - it redirects you to another site. It can be useful and legitimate or just plain deceitful and annoying. It all depends on the intention.

Well if your intentions are good then I'll tell you how it's done. (Or at least show you one way to do it - there's always more than one way.)


Here's some sample code:

(Like all HTML, wrap some brackets < > around it to make it work and pop it into the HEAD of your HTML page, ie after the HTML tag but before the BODY tag.)

meta http-equiv="REFRESH" content="0;url=http://www.the-domain-you-want-to-redirect-to.com"

(Don't forget to close off your "meta" tag, either.)

So what happens here?
Well the meta content="0;url=http://<b>the-domain-you-want-to-redirect-to</b>.com" http-equiv="REFRESH" is the part that actually does the redirecting or "refreshing". The number before the URL (in this case "0") tells your web browser the number of seconds to wait before redirecting to the new address (or URL). You could set this to 3 or 5 and add some explanatory text or just leave it at zero. Whatever suits your purposes.

So what do I do with this?

Just copy the code above into your HTML editor of choice - it could be Kompozer or even just Notepad - and save it as something that makes sense. It could be index.html if it's redirecting traffic off your domain or subdirectory root, which is the most likely use. Don't forget to change the domain name to the one you want to redirect to - and remember you can be explicit, right down to the page you want your visitor to land on.

For example I just put it to use in refreshing a page which contained an inline frame. I had a list of .PDF files inside the frame and if clicked they opened (that's the intention) - but you had to get out and back in again to get back to the list.

Instead of making visitors load a new page and then return I added a "Click here to refresh this list" button that simply took the browser out of that page to "refresh.html", a page that carries a "List refreshing now..." message and the above code. All it does is redirect back to the page with the inline frame - and voila! - the list has refreshed. Job done. And that's a legitimate use.

Sunday, October 10, 2010

Windows Live Messenger encounters problem on startup?

Let me guess. You just updated to the latest version of Live Messenger on Windows XP (and maybe later OS versions as well) and suddenly Live Messenger fails to proceed. It crashes with the "has encountered a problem and needs to close" message. Well I had that as well. And there's a quick fix.

Let me tell you firstly what doesn't work:
  • Reinstalling or repairing Live Messenger via "Add/Remove Programs" in "Control Panel" doesn't work
  • Uninstalling Internet Explore 8 doesn't work
  • Re-installing Internet Explorer 8 doesn't work
  • Running all manner of virus checkers doesn't work.
What does work is this fix from Microsoft: http://windowslivehelp.com/solution.aspx?solutionid=17e5dddf-4156-4725-a1a5-f3a10a76e12f

Well it worked for me, anyway. If you've tried everything else then it's up to you. Another way around this problem is to disable or remove it and use another messenger.