Meta-refresh doesn't work?

GBa picture GBa · Feb 6, 2009 · Viewed 75.2k times · Source

I have a page using something along the lines of

<meta http-equiv="refresh" content="0;url=http://example.com/" />

but for certain users on a certain workstation this doesn't work. The is in IE. Is there something wrong with cookies or a setting somewhere which would cause this to fail? I never heard of such a thing.

Answer

Dave picture Dave · Sep 6, 2009

The problem is that when IE sees this:

<meta http-equiv="refresh" content="0;http://www.example.com" />

it expects the contents attribute to contain a number. The only time IE will check for a URL is if the content attribute contains "URL=" so the redirect that is most usable in all browsers is this:

<meta http-equiv="refresh" content="0;URL=http://www.example.com" />

The above example would redirect immdetiately but if you changed the 0 for another number it would wait that many seconds. Hope this all makes sense, it should work just fine but I still think my first idea was the better one.