level 1
Fun_3692
楼主
网上找到一段代码,定时刷新网页。
刷新某些网站时报错:
Refused to display '<URL>' in a frame because it set 'X-Frame-Options' to 'deny'.
请教如何改进?代码如下:
var timeout = prompt("Set timeout (Second):");
var count = 0;
var current = location.href;
if (timeout > 0) {
setTimeout('reload()', 1000 * timeout);
} else {
location.replace(current);
}
function reload() {
count++;
console.log('每(' + timeout + ')秒自动刷新,刷新次数:' + count);
var fr4me = '<frameset cols="*"><frame src="' + current + '"/></frameset>';
with(document) { write(fr4me); void(close()) }
setTimeout('reload()', 1000 * timeout);
}
2025年04月05日 03点04分
1
刷新某些网站时报错:
Refused to display '<URL>' in a frame because it set 'X-Frame-Options' to 'deny'.
请教如何改进?代码如下:
var timeout = prompt("Set timeout (Second):");
var count = 0;
var current = location.href;
if (timeout > 0) {
setTimeout('reload()', 1000 * timeout);
} else {
location.replace(current);
}
function reload() {
count++;
console.log('每(' + timeout + ')秒自动刷新,刷新次数:' + count);
var fr4me = '<frameset cols="*"><frame src="' + current + '"/></frameset>';
with(document) { write(fr4me); void(close()) }
setTimeout('reload()', 1000 * timeout);
}