FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

URL Redirection - Javascript+HTML, so simple...

 


asturmas
In javascript Browser redirection can be done in 3 ways:

1) Alert Redirect:
CODE
<html>
<script>
alert("This page has been moved to a new location... click OK to be redirected.");
location = "http://www.your-website.com";
</script>
</html>



2) Confirm and Redirect:
CODE
<html>
<script>
if(confirm("This page has been moved to a new location... would you like to be redirected"))
{
location = "http://www.your-website.com";
}
else
{
history.back();
}
</script>
</html>


3) Stealth Redirect:
CODE
<html>
<script>
location = "http://www.your-website.com";
</script>
</html>

Bye
Vrythramax
I think Javascript may be a bit of an overkill here when it can be done simply and directly with META TAGS

Code:

<html>
<head>
  <title></title>
  <meta http-equiv="refresh" content="5; url=http://www.disney.com">
</head>
<body>


With this tag the page will automatically redirect in 5 seconds, the larger the number the longer the wait....you can use negative numbers for instant redirection, such as "-1"
asturmas
This tag and redirection automatically above are manual Wink
Tanks

Bye bye
mtorregiani
Thanks for this, very useful Smile
Marston
Code:
<?
header('Location: http://www.yoursite.com/');
?>
More fool-proof than Javascript.
Ashis Kumar
I use the:

Code:

html>
<head>
  <title></title>
  <meta http-equiv="refresh" content="5; url=http://www.disney.com">
</head>
<body>


Code Laughing
landxxx
This code in my site don't do.

He print ERROR
landxxx
asturmas wrote:
In javascript Browser redirection can be done in 3 ways:

1) Alert Redirect:
CODE
<html>
<script>
alert("This page has been moved to a new location... click OK to be redirected.");
location = "http://www.your-website.com";
</script>
</html>



2) Confirm and Redirect:
CODE
<html>
<script>
if(confirm("This page has been moved to a new location... would you like to be redirected"))
{
location = "http://www.your-website.com";
}
else
{
history.back();
}
</script>
</html>


3) Stealth Redirect:
CODE
<html>
<script>
location = "http://www.your-website.com";
</script>
</html>

Bye



This code is incorrect beacuse this code on my local server say big error with any 18 line in this line is all true.

Why this error in this code????


Rolling Eyes Rolling Eyes Rolling Eyes Rolling Eyes Rolling Eyes
mtorregiani
Line 18?
Each script has less than 10 lines! Laughing
jayzee
gr8 tutorial
Reply to topic    Frihost Forum Index -> Miscellaneous -> Tutorials

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.