There are some simple basic rules to follow
when designing a web page. One of them is keeping your customer happy by
not surprising him with unwanted results. A lot of content sites , which their content expands beyond the window frame also have an auto refresh mechanisms. And this leads to a deadly mixture where you scroll down to the lower parts of the page , you begin reading a paragraph and the "Pooof" the page turns white, the page refreshes and the view is back at the top of the page. Well now of course, you have to scroll down again and find the paragraph you read just a second ago.
The solution is not complicated , it consists of just checking the page's Y scroll offset before a page refresh occurs. [See JS code below]
So from now on when you insert an automatic page refresh, checking for the pages Y offset before refreshing is just telling your customer you care...
...
...
...
function doLoad()
{
setTimeout( "refresh()", 2*1000 );
}
function refresh()
{
// use the following for cross browser compatability
//(document.all)?document.body.scrollLeft:window.pageXOffset;
//(document.all)?document.body.scrollTop:window.pageYOffset;
if("0" == document.body.scrollTop)
{
window.location.href = sURL;
}
else
{
//at this point , the user scrolled
//down and is probably reading the page
//either we double the refresh rate time ,
// or just hang in a few more seconds/minutes
//to let him finish. In this specific case
//we're increasing the refresh time to 2 minutes
setTimeout( "refresh()", 120*1000 );
}
//-->
</script>
</head>
<body onload="doLoad()">
...
...
...