SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Meta Refresh

Hybrid View

  1. #1
    SitePoint Zealot alfred3x's Avatar
    Join Date
    Aug 2003
    Location
    Toronto
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Meta Refresh

    I have a requirement to hit a page, run some JavaScript, and move on to another page. It's uncertain whether the user actually has JavaScript enabled, so I can't use JS to effectuate the move to the second page.

    Here's what I've got:
    Code:
    <html> 
    	<head> 
    		<meta http-equiv='refresh' content='0;url=page2.html'>
    	</head> 
    	<body> 
    		<script src="http://www.example.com/example.js"></script>
    		<script>
    		_xxx = "xxxxxxxxx";
    		xxx();
    		</script>
    	</body> 
    </html>
    My question: will the JS run before the refresh to page2.html?

    I tested this with an alert() in the script and it seemed to work fine. I just thought some of the W3C gurus out here might be able to give more authoritative answers.

    Thanks.
    - A. Alfred Ayache
    PHP/MySQL ZCE

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yes, I think, yes. Even though the timer is set to 0, it does load the whole page and so executes javascript. However, if the javascript took longer to run, most likely the redirect would still occur.

    BTW, not sure if this thread should be in HTML or Javascript forums, but definitely not in PHP.
    Saul


Bookmarks

Posting Permissions

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