Jump to content


Photo

Refresh on load


  • Please log in to reply
5 replies to this topic

#1 BreakBreak

BreakBreak
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 19 October 2006 - 09:05 PM

Is it possible to make a page refresh as soon as it's loaded (i.e green bar at bottom right stops loading)

This would help a lot with my loops that i don't want to end, thanks.

#2 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 19 October 2006 - 09:32 PM

infinite loop.
Or if you want a permanent refresh(totally pointless)
<?php
header('Location: page.php');
?>
it will redirect over to the same page over and over and over again, but there is absolutely no point, unless you wnat to piss people off.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#3 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 20 October 2006 - 01:10 PM

infinite loop.
Or if you want a permanent refresh(totally pointless)
<?php
header('Location: page.php');
?>
it will redirect over to the same page over and over and over again, but there is absolutely no point, unless you wnat to piss people off.


that won't ever fully load, however. what he's asking for is to refresh the page after a full page load. to do this, you'd want to use a javascript refresh. something like this should do the trick:
window.onload = function() {
  window.location.reload(true);
}

remember that with the reload() function, the boolean value passed to it forces it to reload from the server (if it's false, it allows it to reload from cache).
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#4 BreakBreak

BreakBreak
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 20 October 2006 - 01:32 PM

Does the on.load function work if the php terminates the page as it's been running too long?

Where would i put that function above?

#5 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 20 October 2006 - 01:38 PM

the function i showed above is a javascript function, so it's a client refresh. if your server times out because your script was running too long, it will simply die as with any other PHP error. as you asked in your initial post, this doesn't actually force the refresh until the page has completed loading, so while the script is running on the server, it will not refresh.

with that said, you'd simply place that code above within script tags in the head of your page like you would with any other javascript function.

good luck!
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#6 BreakBreak

BreakBreak
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 20 October 2006 - 01:39 PM

Damn, i need it to refresh if the php times out.

What confuses me IMENSELY is that it SOMETIMES times out and other times is completley fine :!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users