I had one requirement to auto refresh any page after specif interval and that should show only that part of the page which content I want to see.
Below is the Java script code which has to be added as a bookmark and click that bookmark after opening the page and scroll down to specific part you want to see after each refresh.
javascript:
refresh_interval=prompt("Set Refresh Interval in Seconds [s]");
current_page=location.href;
if(refresh_interval>0) {
selectedFrame='<frameset cols=\'*\'>\n<frame id="refreshframe" src=\''+current_page+'\'/>';
selectedFrame+='</frameset>';
with(document) {
write(selectedFrame);
void(close())
};
setTimeout('reload()',1000*refresh_interval);
} else {
location.replace(current_page);
}
function reload() {
setTimeout('reload()',1000*refresh_interval);
var frameToSet = document.getElementById('refreshframe');
frameToSet.contentWindow.location.reload(false);
}
Below is the Java script code which has to be added as a bookmark and click that bookmark after opening the page and scroll down to specific part you want to see after each refresh.
javascript:
refresh_interval=prompt("Set Refresh Interval in Seconds [s]");
current_page=location.href;
if(refresh_interval>0) {
selectedFrame='<frameset cols=\'*\'>\n<frame id="refreshframe" src=\''+current_page+'\'/>';
selectedFrame+='</frameset>';
with(document) {
write(selectedFrame);
void(close())
};
setTimeout('reload()',1000*refresh_interval);
} else {
location.replace(current_page);
}
function reload() {
setTimeout('reload()',1000*refresh_interval);
var frameToSet = document.getElementById('refreshframe');
frameToSet.contentWindow.location.reload(false);
}
No comments:
Post a Comment
Thank You for your valuable comment