|
-
Jan 22nd, 2004, 02:27 AM
#1
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.
-
Jan 22nd, 2004, 02:37 AM
#2
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
-
Jan 22nd, 2004, 02:44 AM
#3
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.
-
Jan 22nd, 2004, 03:26 AM
#4
Ok, then how do you make a displayed HTML page shut down (exit) after three seconds?
-
Jan 22nd, 2004, 03:34 AM
#5
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>
-
Jan 22nd, 2004, 04:35 AM
#6
Frenzied Member
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. 
-
Jan 22nd, 2004, 06:28 AM
#7
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.
-
Jan 22nd, 2004, 07:31 AM
#8
Frenzied Member
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. 
-
Jan 22nd, 2004, 10:35 AM
#9
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.
-
Jan 22nd, 2004, 10:35 AM
#10
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.
-
Jan 22nd, 2004, 10:43 AM
#11
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.
-
Jan 22nd, 2004, 10:44 AM
#12
Frenzied Member
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. 
-
Jan 22nd, 2004, 11:04 AM
#13
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|