Timed Redirect with warning to multiple pages

Discussion in 'Javascript' started by lonlyboy, May 30, 2009.

  1. lonlyboy

    lonlyboy Guest

    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
    lonlyboy, May 30, 2009
    #1
    1. Advertising

  2. 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

    --
    Trevor Lawrence
    Canberra
    Web Site http://trevorl.mvps.org



    "lonlyboy" <> wrote in message
    news:...
    > 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
    Trevor Lawrence, May 30, 2009
    #2
    1. Advertising

  3. lonlyboy wrote:
    > I'm looking for a script I can use that warns a user they are leaving
    > my site.


    No, you don't. Trust me.


    PointedEars
    Thomas 'PointedEars' Lahn, May 30, 2009
    #3
  4. Thomas 'PointedEars' Lahn wrote:
    > lonlyboy wrote:
    >> I'm looking for a script I can use that warns a user they are leaving
    >> my site.

    >
    > No, you don't. Trust me.
    >


    Don't what?

    I am looking..no you are not..surely?

    >
    > PointedEars
    The Natural Philosopher, May 30, 2009
    #4
  5. lonlyboy

    David Mark Guest

    On May 30, 5:17 am, The Natural Philosopher <>
    wrote:
    > Thomas 'PointedEars' Lahn wrote:
    > > lonlyboy wrote:
    > >> I'm looking for a script I can use that warns a user they are leaving
    > >> my site.

    >
    > > No, you don't.  Trust me.

    >
    > Don't what?
    >
    > I am looking..no you are not..surely?
    >


    You are babbling. The point is that it is a stupid idea. The only
    sound advice is to skip it.
    David Mark, May 30, 2009
    #5
  6. lonlyboy

    Mike Duffy Guest

    David Mark <> wrote in news:3e3b3106-4df8-44cf-a1a9-
    :

    > On May 30, 5:17 am, The Natural Philosopher <>
    > wrote:
    >> Thomas 'PointedEars' Lahn wrote:
    >> > lonlyboy wrote:
    >> >> I'm looking for a script I can use that warns a user they are leaving
    >> >> my site.

    >>
    >> > No, you don't.  Trust me.

    >>
    >> Don't what?
    >>
    >> I am looking..no you are not..surely?
    >>

    >
    > 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.
    Mike Duffy, May 30, 2009
    #6
  7. lonlyboy

    David Mark Guest

    On May 30, 11:29 am, Mike Duffy <> wrote:
    > David Mark <> wrote in news:3e3b3106-4df8-44cf-a1a9-
    > :
    >
    >
    >
    > > On May 30, 5:17 am, The Natural Philosopher <>
    > > wrote:
    > >> Thomas 'PointedEars' Lahn wrote:
    > >> > lonlyboy wrote:
    > >> >> I'm looking for a script I can use that warns a user they are leaving
    > >> >> my site.

    >
    > >> > No, you don't.  Trust me.

    >
    > >> Don't what?

    >
    > >> I am looking..no you are not..surely?

    >
    > > 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.


    You've got the attributes backwards.
    David Mark, May 30, 2009
    #7
  8. lonlyboy

    Mike Duffy Guest

    David Mark <> wrote in
    news::

    > On May 30, 11:29 am, Mike Duffy <> wrote:
    >>
    >> 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.


    Upon sober reflection, I believe you are correct.
    (href title="..text"; img alt="..text")
    Mike Duffy, May 30, 2009
    #8
  9. Mike Duffy wrote:

    > 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
    Osmo Saarikumpu, May 31, 2009
    #9
  10. Trevor Lawrence wrote:

    > Try this


    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 Saarikumpu, May 31, 2009
    #10
  11. lonlyboy

    David Mark Guest

    On May 31, 3:02 pm, Osmo Saarikumpu <> wrote:
    > Mike Duffy wrote:
    > > 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.


    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.")
    David Mark, May 31, 2009
    #11
  12. "Osmo Saarikumpu" <> wrote in message
    news:4a22d834$0$26319$...
    Trevor Lawrence wrote:

    > Try this


    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?

    --
    Trevor Lawrence
    Canberra
    Web Site http://trevorl.mvps.org
    Trevor Lawrence, Jun 1, 2009
    #12
  13. lonlyboy

    David Mark Guest

    On May 31, 10:18 pm, "Trevor Lawrence" <Trevor L.@Canberra> wrote:
    > "Osmo Saarikumpu" <> wrote in message
    >
    > news:4a22d834$0$26319$...
    >
    > Trevor Lawrence wrote:
    > > Try this

    >
    > 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.


    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.
    David Mark, Jun 1, 2009
    #13
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve
    Replies:
    0
    Views:
    5,327
    Steve
    Jul 1, 2003
  2. Lloyd Sheen

    Timed redirect of web page

    Lloyd Sheen, Dec 4, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    4,250
    Lloyd Sheen
    Dec 4, 2003
  3. Sal
    Replies:
    1
    Views:
    403
  4. Glenn Lankin

    DLLHOST --asp pages timed out

    Glenn Lankin, Sep 29, 2003, in forum: ASP General
    Replies:
    1
    Views:
    119
    Atrax
    Sep 30, 2003
  5. FN

    timed redirect to another page

    FN, Jul 11, 2003, in forum: Javascript
    Replies:
    3
    Views:
    116
    Evertjan.
    Jul 12, 2003
Loading...

Share This Page