Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple redirect question

Status
Not open for further replies.

spicymango

Programmer
May 25, 2008
119
0
0
CA
Hi,

In the followind code they are redirecting the page using javascript.

What I don't understand why they had to put the same URL redirect in the META Tags, why is it necessary?
Code:
<HTML><HEAD><TITLE></TITLE> 
<SCRIPT language="JavaScript"> 
<!-- 
	window.location = &amp;amp;quot;[URL unfurl="true"]http://www.mydomain.com/pages/employee/start.shtml&amp;amp;quot;[/URL]
//-->
</SCRIPT> 
<META http-equiv="refresh" content="1; URL=http://www.mydomain.com/pages/employee/start.shtml">
</HEAD>
<BODY>

</BODY></HTML>
 
In case Javascript is turned off, or not supported in he client viewing the page would be my guess.

Other than that, its pointless, as the JS redirect will inevitably occur before reaching that section of the page.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
If you're thinking of using that code, I'd dispense with the JS altogether... it's completely unnecessary as the redirect will happen regardless.

I'd also update the "1;" in the META element to be "0;", as this will mean an immediate redirect (which is what the JS would do) instead of waiting 1 second.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Snippets & Info:
The Out Atheism Campaign
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top