Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refreshing-reloading

Status
Not open for further replies.

seti

Programmer
Oct 23, 2000
40
BE
Hi,

I have a website, that gives - in a pop-up - a pricelist.
Now in order to constantly have the latest pricelist I want to reload the page ONE time.

Can somebody please help me with that..

seti
 
When do you want the page to reload. Automatically on a timer, when someone selects something from a list ??

Help ??

ToddWW :)
 
immediately, but only once, without hitting a button..
 
Immediately when ?? Immediately after the page initially loads ?? Immediately after someone does something on the page ??

Does this have something to do with your fear that your visitors may pull your page out of cache instead of going to the server for an updated page ?? If so, there are better ways to solve that.

Are you using any server side solutions like ASP.

ToddWW
 
the only way I can see that would be done is like this:

Code:
<script Language=&quot;JavaScript&quot;>
if (location.search=='') {
alert('yep');
location=location+'?refreshed=yes;'
} else {
alert('refreshed');
}

</script>

however, there is a problem with this: if the user bookmarks the page, it wont refresh. it will only refresh if the user navigates to the page.
theEclipse
eclipse_web@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
and only seconds later: I come up with a soloution! here is the new code:

Code:
<script Language=&quot;JavaScript&quot;>
var date=new Date();
var time=date.getMinutes();

if (location.search!='?'+time+';') {
location=location+'?'+time+';'
}

</script>

this will reload the page if the current minute on the clock is not on the search string. it is possable, however unlikely, that they will visit the page at a later hour, with exactly the same minute. like I said, this is unlikely. theEclipse
eclipse_web@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
do it with just date = new Date(), that will give you the number of miliseconds since 1970 something, that way it can't be repeated -Greg :-Q

flaga.gif
 
yes, that would work, except then you would never get to see the page. you would end up with a never ending loop that would refresh the page over an over again until you three-finger out of it (ctrl-alt-del). (can you tell I tried that and got stuck there myself? LOL) theEclipse
eclipse_web@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
what a meant was link to it like that, then for the bookmark issue, you would have to check documen.referer and refresh (or send back to the main page) based on that -Greg :-Q

flaga.gif
 
I am not sure I follow. what do you mean link to it like that? do you mean add the new Date() to the end of all the links to that page? I would think that alittle time consuming. theEclipse
eclipse_web@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
no, he said it was a popup, so i'm assuming its called with window.open, so it would be like this (sorry i worded that last post wrong):

window.open(&quot;prices&quot;, &quot;pop.htm?time=&quot; + date, [params]);

-Greg :-Q

flaga.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top