Forum Moderators: mack

Message Too Old, No Replies

Message box before redirect? (ASP and VBscript)

or time delay before redirect?

         

hoffj

7:29 pm on Apr 8, 2004 (gmt 0)

10+ Year Member



I want to let users know why they are being redirected to a specific page.

I am trying to find a way to either:
- use a message box that the user would have to click before the redirect page loads
- display the info on the page, wait a few seconds and then redirect them
--- or some similar solution

I am redirecting visitors to different pages based on their geographical location. I use the IP-to-Country database to get their locations--this part works fine.

Here is essentially what I am working with... I just don't want to redirect without some sort of notification first.

<%
if location = "X" then
Response.Redirect("webpage 1")

else
Response.Redirect("webpage 2")

end if
%>

Thanks for the help.

pmkpmk

8:24 pm on Apr 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to webmasterworld, hoffj!

I do not know the nature of your web offerings and whether geo-targeting is essential to it. If it would only be for load-balancing or response-time, you probably would not need to explain WHY you redirect...

But from a visitor's perspective let me tell you this: I hate sites which don't give me a choice! Maybe I want to see the page of the branch-office in Timbuktu! Maybe I want to see how the product is called in Kroatia or what it's price is in New Zealand. Maybe I'm looking for an old buddy of mine who runs tech-support in Guatemala?

My approach would be, to use geo-targeting as a help. Say something along the lines of "we detected that you come from South-Africa and would like to suggest the page of our branch office in Cape Town (link...) to you". But leave the visitor the choice!

Regarding your specific question:

Why don't you redirect TWICE?

Initial page --> Redirect to intermediate page with explanation --> redirect to final page

[edited by: pmkpmk at 8:30 pm (utc) on April 9, 2004]

john_k

8:28 pm on Apr 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The timer needs to be established on the client, so this is really a javascript issue, and not a server scripting issue.

Use setTimeout in the BODY tag:

<body onload="setTimeout('document.location=\'otherpage.asp\'',5000);">

note: those are two apostrophes after the .asp\

wavebird23

10:33 pm on May 13, 2004 (gmt 0)

10+ Year Member



I believe the best way to do that, is to insert a javascript countdown redirect code:

<form name="redirect">
<center>
<font face="Arial"><b>You will be redirected to a new website in<br><br>
<form>
<input type="text" size="3" name="redirect2">
</form>
seconds</b></font>
</center>
<script>
<!--
//change below target URL to your own
var targetURL="http://www.thewebsiteyouwanttoredirectto.com"
//change the second to start counting down from
var countdownfrom=10

var currentsecond=document.redirect.redirect2.value=countdownfrom+1
function countredirect(){
if (currentsecond!=1){
currentsecond-=1
document.redirect.redirect2.value=currentsecond
}
else{
window.location=targetURL
return
}
setTimeout("countredirect()",1000)
}

countredirect()
//-->
</script>

Let me know if this helps you!