首页加载后一次刷新页面 [英] One time page refresh after first page load

查看:132
本文介绍了首页加载后一次刷新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现一个JavaScript代码,声明如下:
如果页面完全加载,立即刷新页面,但只刷一次。
我被困在只有一次:

I would like to implement a JavaScript code which states this: if the page is loaded completely, refresh the page immediately, but only once. I'm stuck at the "only once":

window.onload = function () {window.location.reload()}

这给出了一个没有只有一次的循环。 。如果这能帮助jQuery是加载

this gives a loop without the "only once". jQuery is loaded if this helps.

推荐答案

我说用散,像这样的:

window.onload = function() {
    if(!window.location.hash) {
        window.location = window.location + '#loaded';
        window.location.reload();
    }
}

这篇关于首页加载后一次刷新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆