Results 1 to 13 of 13

Thread: HTML: How do you display a page for three seconds then exit

  1. #1

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    HTML: How do you display a page for three seconds then exit

    I want to display a pop-up page (message) then exit that page after three seconds. How would I go about this?

    Is this similar to a META refresh tag?
    Last edited by randem; Jan 22nd, 2004 at 02:37 AM.

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    You can use java script to pop up a page and then close it after 3 seconds, just google for it (I don't know java script very well).

    Though I really wish you wouldn't do this. I hate this stuff and my browser won't even open the initial pop-up

  3. #3

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385
    kasracer

    Not neccessarily looking for a pop-up window. I just need to display some status info to the user while time passes to keep them from pressing on the link again until I can connect to the FTP site (or give the browser time to put up its message).

    I am doing this from a perl script. You know of a better way. I forgot about the pop-ups. I do not want that either, I block those too. So pop-up isn't what I really want.

  4. #4

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385
    Ok, then how do you make a displayed HTML page shut down (exit) after three seconds?

  5. #5

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385
    Actually, here is the page I want to disappear after three seconds

    Code:
    Content-type: text/html
    
    <html>
    <head>
    <title>File Download</title>
    </head>
    <style type="text/css">
    <!--
    A:visited {text-decoration: none;; color: #000000}
    A:link {text-decoration: none;; color: #000000}
    A:active {text-decoration: none;; color: #000000}
    A:hover {text-decoration: underline; color:red;}
    td {  font-family: Arial, Helvetica, sans-serif; font-size: 8pt}
    tt {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13pt; font-weight: bold}
    -->
    </style>
    </head>
    <body bgcolor="#FFFFFF">
    <center>
    <table width="600" height="50" border="0" cellspacing="0" cellpadding="3" align="center">
      <tr>
        <td><tt>Contacting Download Site Please Wait...</tt>
      </tr>
    </table>
    
    <script>
    window.location = "http://68.195.10.97/downloads/Test.zip"
    </script>

  6. #6
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    Won't that opage automatically change to Test.zip when the file is downloaded?
    what you could so is this:
    Place all the code you want hidden in a span called mySpan
    ie. <span id="mySpan">My HTML code which will be hidden</span>
    Then run this code onLoad:
    Code:
    MYTimer = setTimeout("document.getElementById('mySpan').innerHTML=''",3000)
    That will delete the text in the span after 3 secs.
    Have I helped you? Please Rate my posts.

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Acidic is probably right. Once the browser attempts to download the file, JavaScript might not be executed anymore. On the other hand, if it is executed too early (e.g. before the browser has contacted the server) the file might not get downloaded at all.



    Just a question though. So many download pages don't have this and work fine. Why is this such a problem for you?


    To build on Ac's code and completly remove the span, not only emtying it:
    Code:
    setTimeout("var e = document.getElementById('mySpan'); e.parentNode.removeChild(e)",3000);
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  8. #8
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    I know CB, I could also have used outerHTML instead of innerHTML to remove it.

    Yes, why exactly is this a problem?
    Have I helped you? Please Rate my posts.

  9. #9

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385
    CornedBee


    Well, this does not work for me because, When the user clicks on the link to download files. the browser attempts to contact the FTP site and this looks like nothing is happening. So the user clicks on it again.

    Now as far as download counts, this throws the counts off because the second or third download is usually cancelled. I need an acurate count to coincide with the actual bandwidth my ISP is charging me for.

    So to put up any kind of message that something is happening will deter clicking on the link again.

  10. #10
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    No, you couldn't safely use outerHTML, it's only implemented by IE.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  11. #11
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I think in another thread it's already been suggested. Make the link point to a download page which says "the download will begin shortly, please stand by". Then forward to the ftp url.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  12. #12
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    thx CB.

    randem, I would do this instead in that case.
    make a link to the file, like you have done before. then make a message pop up (not in a new window) telling them to hold on for a minute or two:
    Code:
    <script type="text/javascript">
    function doIt() {
    document.getElementById('mySpan').innerHTML = "<font color='red'>Please wait a minute for the download to work</font>"
    location.href = "ftp://123.123.123/1223.zip" /*Obviously this line needs changing */
    }
    </script>
    <span id="mySpan"></span>
    <button onClick="doIt()">Get the file</button>
    Have I helped you? Please Rate my posts.

  13. #13

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385
    Acidic


    I will try that. Now if the user does not have Java enabled it will need a <noscript> section that just downloads the file with no message, yes?

    I have seen this somewhere, true.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width