Javascript preload+redirect html page

  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Posts: 135
  • Loc: Bulgaria

Post 3+ Months Ago

What's the code to make the following:
There's a html page that waits a little,
then automatically preloads/redirects to
another html page?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • gonzoka
  • Student
  • Student
  • gonzoka
  • Posts: 75
  • Loc: Bristol, UK

Post 3+ Months Ago

This is possible to do, but much more straight forward and browser friendly to do using HTTP headers instead. See http://webdesign.about.com/od/metatagli ... 80300a.htm which explains how to use these - put them within the <head> tag in your html.
  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Posts: 135
  • Loc: Bulgaria

Post 3+ Months Ago

So I just adjust and put this
Code: [ Select ]
<meta http-equiv="refresh" content="2;url=http://webdesign.about.com">

into my <head> HTML, right? Thanks!
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

right
  • videoediting-direct
  • Beginner
  • Beginner
  • videoediting-direct
  • Posts: 53
  • Loc: United Kingdom

Post 3+ Months Ago

Code: [ Select ]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
ZHTML>
<HEAD>
<TITLE> New Document </TITLE>
<script language="javascript">
    function Redirectfun()
    {
self.setInterval('clock()', 1000*60*3)
window.location="htmlpage.html";
    }
    </script>
</HEAD>

ZBODY onload="Redirectfun()";>

</BODY>
</HTML>
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. ZHTML>
  3. <HEAD>
  4. <TITLE> New Document </TITLE>
  5. <script language="javascript">
  6.     function Redirectfun()
  7.     {
  8. self.setInterval('clock()', 1000*60*3)
  9. window.location="htmlpage.html";
  10.     }
  11.     </script>
  12. </HEAD>
  13. ZBODY onload="Redirectfun()";>
  14. </BODY>
  15. </HTML>
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

V-D ... don't you think that the HTML way is better? because people could have javascript disabled and the HTML way is smaller ...
  • videoediting-direct
  • Beginner
  • Beginner
  • videoediting-direct
  • Posts: 53
  • Loc: United Kingdom

Post 3+ Months Ago

Here goes HTML stuff;

Code: [ Select ]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta http-equiv="Refresh" content="5;url=http://www.test.com">
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>

<BODY>
<!-- PLACE YOUR BODY CONTENT HERE -->
</BODY>
</HTML>
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE> New Document </TITLE>
  5. <meta http-equiv="Refresh" content="5;url=http://www.test.com">
  6. <META NAME="Generator" CONTENT="EditPlus">
  7. <META NAME="Author" CONTENT="">
  8. <META NAME="Keywords" CONTENT="">
  9. <META NAME="Description" CONTENT="">
  10. </HEAD>
  11. <BODY>
  12. <!-- PLACE YOUR BODY CONTENT HERE -->
  13. </BODY>
  14. </HTML>

You need to add the meta tag in the header
'<meta http-equiv="Refresh" content="5;url=http://www.test.com"> ' and replace the 'www.test.com' with your URL. This will wait for 5 seconds then will be redirected to the URL specified.
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

Exactly like graphixboy stated, V-D, maybe just add some [code] tags around pieces of code to make it easier to read ...
  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Posts: 135
  • Loc: Bulgaria

Post 3+ Months Ago

I'll just stick to the meta one (^^)

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: rohanratnaparkhi and 50 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.