Forum Moderators: open

Message Too Old, No Replies

Javascript that fully functions like meta refresh

Javascript that allows refresh and time delay

         

sharon_357

1:07 pm on Nov 7, 2005 (gmt 0)

10+ Year Member



I've spent about six hours trying to figure out how to go about using a metatag refresh (or javascript) inside a frame, that allows a large animated gif to load about 15 seconds *after* the main page is executed and starts loading, without the problem of the visitor having to click back out 2 or 3 times to get back to point of origin (because of html files that were stored in the browser.)

I've surfed all over Google, and the above script is the *closest* I've came thus far, but something isn't quite right. However, the script doesn't allow the browser 15 seconds to load the iframe, it immediately refreshes to the new page. That defeats the purpose --giving the rest of the page time to load, before executing the framed file.

Please double check that script and find out if there is a reason it is not allowing the time-delay of x# of seconds before loading that redirect or refresh target page.

----

I found another great page on the problem. Yet, I am facing the same problem with the iframe immediately loading the large animation, no time delay. I'm using Internet Explorer 6.0.

<script>
<!--
var version = parseInt(navigator.appVersion)
// replace is supported

if (version>=4 ¦¦ window.location.replace)
window.location.replace("http://www.example.us/frames/universe/")
else
window.location.href = "http://www.example.us/frames/universe/"
// -->
</script>

The information is *perfect*, except... how to set delayed loading time?

This code automatically refreshes to the page that's targeted, but gives no delay time (half of what a meta refresh tag is used for). I noticed in my search all over the web the majority of webmasters overlook that aspect.

That's the whole purpose for my using a refresh meta tag inside a frame, --to give the rest of the page time to load, before loading these sizeable graphics into the frame.

But if our visitors want to click on the back button and leave our website, I do not want them trapped with a disabled back button that's loading meta refresh pages. I want them to be able to return right back to wherever they came from. Having to make multiple clicks on the back button is aggravating and confusing).

Please explain how to set a time delay in the javascript?

I want it to load in 15 seconds, not immediately.

Thanks, Sharon

[edited by: jatar_k at 6:37 pm (utc) on Nov. 7, 2005]
[edit reason] no urls thanks [/edit]

sharon_357

1:20 pm on Nov 7, 2005 (gmt 0)

10+ Year Member



Here is the HTML on the "Loading Page" -- the purpose: as our web pages are loading, the visitor sees a small "Loading" statement scrolling inside an iframe. After 15 and 20 seconds, the web page has likely finished loading... then, these large files load into the page. If they want to leave, I don't want to break their back button with meta refresh pages.

I need the script to #1 Wait 15 seconds before loading the advertisement.

I need the script to #2 Not leave a record in their browser history of this loading page, so they can return to their point of origin without hinderance.

<html>
<head>
<title>Loading...</title>
<meta name="robots" content="noindex,follow">
<meta http-equiv="refresh" content="15; url=http://www.example.us/frames/universe/">

<script>
<!--
var version = parseInt(navigator.appVersion)
// replace is supported

if (version>=4 ¦¦ window.location.replace)
window.location.replace("http://www.example.us/frames/universe/")
else
window.location.href = "http://www.example.us/frames/universe/"
// -->
</script>

<style>body {scrollbar-arrow-color: #5B5959; font-family: tahoma; font-size: 12; scrollbar-darkshadow-color: #000000; scrollbar-base-color: #ececec; background-color: #131617} a {color: #808080; text-decoration:none} a:hover{font-weight:bold}</style>

</head>

<body bgcolor="#131617">

<font color="#cccccc">

<a name=scrollingCode></a>
<marquee onmouseover="this.stop()" onmouseout="this.start()" scrollAmount=2 scrollDelay=1 direction="left" width=500 height=355 align="left">
<sup><strong>L o a d i n g . . . . </strong></sup>
</marquee>
</font>
</body>

</html>

[edited by: jatar_k at 6:38 pm (utc) on Nov. 7, 2005]
[edit reason] generalized urls [/edit]

kaled

2:28 pm on Nov 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need something like this:-

setTimeout("location.replace('target.html')",5000);

The code above will redirect to target.html after 5 seconds.

You should read the terms of service with respect to dropping links in the forums.

Kaled.

sharon_357

3:06 pm on Nov 7, 2005 (gmt 0)

10+ Year Member



Kaled: The code above will redirect to target.html after 5 seconds.
You should read the terms of service with respect to dropping links in the forums.

Sharon: It wasn't meant like that. My apologies if my intentions were misunderstood. Just being very precise about what I'm after, up front. I spent a good 2 or 3 days studying all over the web and tried every kind of search string --been on this forum a few times during my search, the closest I came to an answer were the two pages (listed above) and I never post in forums unless it is a last resort.

--

Kaled: You need something like this:-
setTimeout("location.replace('target.html')",5000);

Sharon: Thank you for that piece of code, but where and how does that piece of code fit into the javascript? I am one of those individuals not so familiar with writing javascripts, and one character in the syntax can disable the entire script. I'd appreciate the tip on how it is written in the code. Like many webmasters, I'm still learning about javascript.

kaled

4:18 pm on Nov 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<head>
.....
<script type="text/javascript">
<!--
setTimeout("location.replace('target.html')",5000);
-->
</script>
.....
</head>

Kaled.

sharon_357

4:58 pm on Nov 7, 2005 (gmt 0)

10+ Year Member



Wahoo. It works!

I've spent around 3 days now searching a solution...

A million thanks.