Timed Redirect with warning to multiple pages

L

lonlyboy

I'm looking for a script I can use that warns a user they are leaving
my site. Then after like 5 seconds continues on to the site. I have
a list of about 100 links and I don't want to have to create a
seperate page for each link. Would be nice to setup a page that I can
use a script on.

i.e. page?link=google.com

This would display my warning page for 5 seconds then continue on to
google.com

or page?link=hotmail.com

This would show my warning ofr 5 seconds and continute on to
hotmail,com .. .etc..

Anyone know of a way to script this?

Thanks
LonlyBoy
 
T

Trevor Lawrence

Try this

<html>
<head>
<title>Redirect</title>
<script type="text/javascript">
function redir(url) {
document.write("You will be redirected in 5 seconds")
setTimeout('location.href="' + url + '"',5000)
}
</script>
</head>
<body>
<input type="button" value="Redirect" title="Redirect"
onclick="redir('rollover.html')" />
</body>
</html>

The filename between onclick="redir(' and ')" is the URL that you want to go
to
 
M

Mike Duffy

You are babbling. The point is that it is a stupid idea. The only
sound advice is to skip it.

A much less obnoxious alternative is simply to append the text " (External
Link)" to the href (alt attribute) and img (title attribute) tags.
 
D

David Mark

(e-mail address removed):





A much less obnoxious alternative is simply to append the text " (External
Link)" to the href (alt attribute) and img (title attribute) tags.

You've got the attributes backwards.
 
O

Osmo Saarikumpu

Mike said:
Upon sober reflection, I believe you are correct.
(href title="..text"; img alt="..text")

Still not good. The alt attribute is for alternative text, in case the
image is not displayed for a reason or another. The title attribute
(advisory title) would be proper for both, links and images.

HTH, Osmo
 
O

Osmo Saarikumpu

Trevor said:

For what?¹
<html>
<head>
<title>Redirect</title>
<script type="text/javascript">
function redir(url) {
document.write("You will be redirected in 5 seconds")
setTimeout('location.href="' + url + '"',5000)
}
</script>
</head>
<body>
<input type="button" value="Redirect" title="Redirect"
onclick="redir('rollover.html')" />

This does not look good. What happens if there is no JavaScript support
available?

¹ http://www.netmeister.org/news/learn2quote.html

Best wishes,
Osmo
 
D

David Mark

Still not good. The alt attribute is for alternative text, in case the
image is not displayed for a reason or another. The title attribute
(advisory title) would be proper for both, links and images.

Clearly it depends on the content, but in most cases the text would be
different.

<a href="..." title="Send a message to me"><img alt="Contact"
src="..."></a>

IIRC, IE fouls things up with tooltips, which requires a redundant
title for the image in this case (otherwise will advise "Contact.")
 
T

Trevor Lawrence

Trevor said:

For what?¹
<html>
<head>
<title>Redirect</title>
<script type="text/javascript">
function redir(url) {
document.write("You will be redirected in 5 seconds")
setTimeout('location.href="' + url + '"',5000)
}
</script>
</head>
<body>
<input type="button" value="Redirect" title="Redirect"
onclick="redir('rollover.html')" />

This does not look good. What happens if there is no JavaScript support
available?

¹ http://www.netmeister.org/news/learn2quote.html

Best wishes,
Osmo


Osmo,

Quite true. It won't work without JavaScript, but I assumed (perhaps
wrongly) that the poster wanted a JS solution.

Is there a non-JS solution, I wonder?
 
D

David Mark

For what?¹


This does not look good. What happens if there is no JavaScript support
available?

¹http://www.netmeister.org/news/learn2quote.html

Best wishes,
Osmo

Osmo,

Quite true. It won't work without JavaScript, but I assumed (perhaps
wrongly) that the poster wanted a JS solution.

A JS solution that leaves a non-functioning button when scripting is
disabled is not a solution.

And you can't do anything after a document.write.
Is there a non-JS solution, I wonder?

No need to wonder. See other posts in this thread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top