Closed Thread Icon

Topic awaiting preservation: page refresh script (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8356" title="Pages that link to Topic awaiting preservation: page refresh script (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: page refresh script <span class="small">(Page 1 of 1)</span>\

 
Lord_Fukutoku
Paranoid (IV) Inmate

From: West Texas
Insane since: Jul 2002

posted posted 10-19-2002 06:39

This might be a bit of an odd request, but is there a fairly easy way to get a page to reload after a specified number of milliseconds? I've found one or two scripts with a lot of extra stuff I could cut out, however, they only start counting after the page loads, i.e. : window.onload=call_refresh_function

Afaik, there isn't a way to get a single page to start a timed refresh script before the page loads entirely...
However, if I were to create a page of frames, I could have a static frame (probably gonna end up a control bar in it) that has the script refreshing other frames without having to reload the script every time... Sound good so far?

Back to my question... The only scripts I've seen have a minimum "countdown" time of 1 second. Is there a way to get down to smaller increments than this?

Sidenote - It doesn't have to be pretty, it just needs to work And at the moment, it only has to work in MSIE6.

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 10-19-2002 07:31

Put this in the head:

<scipt type="text/javascript">
setTimeout("this.location = 'url' ",1000)
</script>

That's for a one second refresh. Now it you put 1 instead of 1000, it will be 1 1000'th of a second. 500 for half a second and so on. Will work in any browser.

But um, why would you want a page to refresh before it's loaded? What's the point?

edit: oh change the URL bit to the URL of page to load.

[This message has been edited by Dracusis (edited 10-19-2002).]

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 10-19-2002 08:21

If you're trying to foward the user, rather than refresh, then try

location.replace('newurl')

because that will prevent the current page from entering in the user's history (the back button will skip by it).

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 10-19-2002 08:23

Hey that's cool. I hate it when my back button goes to an instant redirect page.

Nevel
Bipolar (III) Inmate

From: Amsterdam
Insane since: Jun 2002

posted posted 10-19-2002 17:03

Maybe I'm being just a fool, but why not use the old meta-tag in order to do this?
<META HTTP-EQUIV=Refresh CONTENT="10; URL=http://www.whatever.com/"> might just do the trick.
That is, if you're planning to forward AFTER the page has been loaded.

See http://www.htmlhelp.com/reference/html40/head/meta.html for info on this.

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 10-19-2002 18:17

I've updated the FAQ on this to reflect the advice given here:

How can I redirect a page with JavaScript?

The metatag equivalent is mentioned here:

How can I redirect a page with HTML?

___________________
Emps

FAQs: Emperor

Lord_Fukutoku
Paranoid (IV) Inmate

From: West Texas
Insane since: Jul 2002

posted posted 10-19-2002 20:32

Thanks everyone. I think Drac has what I'm looking for with: setTimeout("this.location = 'url' ",1000)
That oughta give me the start I need to get the rest of it together.

quote:
But um, why would you want a page to refresh before it's loaded? What's the point?

I knew someone would ask
I'm just trying to automate a rather trivial task of cycling through a few pages several hundred times. However, I don't need to load the entire page, graphics and all, it just needs to be long enough to send the info to the database and move on.


As for the META tag, I used something like that awhile back, and I seem to remember it waiting until the page loaded before refreshing/forwarding... However, I could be wrong.

________________________________________________________________
-- Jack of all trades, master of that which has my attention at
the moment.

Unoriginal Cell 693

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 10-20-2002 03:11

Ok, in that case you'll want to put the script code just after the back end code that talks to the DB or it might fire x time after it reads post the head with could be bad.

Although, why can't you just set a loop statment in the server sider code to set the data into the databese?

Seems an awfully bizarre way to run a looping bit of code to me.

Lord_Fukutoku
Paranoid (IV) Inmate

From: West Texas
Insane since: Jul 2002

posted posted 10-20-2002 19:05

Like I said, "This might be a bit of an odd request."

quote:
why can't you just set a loop statment in the server sider code

Well, that would be a lot easier I suppose, however I'm not working with my pages, otherwise I would.

I was getting bored at school/work the other day and wanted to see if there was a way to do that. Actually, I knew there was at least one way, just wanted to see how involved it would be.

Thanks for the help everyone.

Let's just say this "project" is a bit of a Rube Goldberg pgae

« BackwardsOnwards »

Show Forum Drop Down Menu