1 replies
So I want to send people to a page that will eventualy redirect to them to the content they want, I am having a problem because i want the code to take a variable from the url, for example the site I want it to redirext to would be specified in the original url, for example:

Code:
www.site.com/file.php?page=www.redirectedsite.com
Redirected site being the new url...

At first i tried this, combining some php
Code:
<html>
<head>
<script type="text/javascript">
function delayedRedirect(){
    window.location = "<?php echo $_GET['page']; ?>"
}
</script>
</head>
<body onLoad="setTimeout('delayedRedirect()', 3000)">
<h2>You'll be redirected soon!</h2>
</body>
</html>
If I replace the red bit with a normal url such as Google It will redirect no problem but with the php It takes the url but gives me www.site.com/http://www.google.com

I have tried to explain the best I can, any help would be wonderful

Thanks In advance!

I have also tried this but it dosent even pick up the redirect url...

Code:
<html>
<head>
<script type="text/javascript">
var link = getUrlVars()["page"];
function delayedRedirect(){
    window.location = link
}
</script>
</head>
<body onLoad="setTimeout('delayedRedirect()', 3000)">
<h2>You'll be redirected soon!</h2>
</body>
</html>
#javascript #redirect
  • Profile picture of the author Amir Khan
    Please delete thread, double post!
    {{ DiscussionBoard.errors[1622717].message }}

Trending Topics