Jump to content

Recommended Posts

Hi

 

I am using the following script to auto refresh my web page. It works fine but the page has a scroll bar, every time it refreshes the page returns to the top and I have to scroll to the bottom again.

 

I would like the page to refresh from the bottom without going back to the top and the need to scroll down being neccessary every time.

 

Can anybody tell me how to achieve this please.

 

The auto refresh script I am using is:

<script type=text/javascript>
// The time out value is set to be 10,000 milli-seconds (or 10 seconds)
setTimeout(' document.location=document.location' ,5000);
</script>

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/154072-auto-refresh-issue/
Share on other sites

Hi

 

Many thanks for your reply, it was a great help. However I could do with a little more please.

 

On reflection, I actually need the refresh to refresh at the last scroll position not the bottom of the page.

 

Sorry for the confusion, but it was only when I applied you help that I realised it would be far better to refresh at the last scroll position.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/154072-auto-refresh-issue/#findComment-814588
Share on other sites

Impossible! How can you detect what portion of the page a user is reading. Depending on your page layout the amount of scroll greatly differs with screen resolution. An alternative is not to reload but use AJAX to do whatever it is you are attempting if a condition is met.

Link to comment
https://forums.phpfreaks.com/topic/154072-auto-refresh-issue/#findComment-814639
Share on other sites

Hi Neil

 

Ok thats answered that. So could you help a little further. I could well be doing something wrong, but when I used your script you provided to get the page to refresh to the bottom it did exactly that.

 

The problem was that I have the page set to refresh every 10 seconds.

 

So the page loaded and refreshed 10 seconds later to the bottom, which was great, but after that the 10 second refresh stopped working.

 

So in other words it did it once and was then static and not refreshing.

Link to comment
https://forums.phpfreaks.com/topic/154072-auto-refresh-issue/#findComment-814652
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.