大家好,又见面了,我是你们的朋友全栈君。
jquery监听浏览器刷新
基本代码段,用于在使用JavaScript调整浏览器大小的情况下刷新页面 。
//refresh page on browser resize
$(window).bind('resize', function(e)
{
console.log('window resized..');
this.location.reload(false); /* false to get page from cache */
/* true to fetch page from server */
});
如果window.location.reload()在Firefox中不起作用,请尝试以下操作。
//refresh page on browser resize
$(window).bind('resize', function(e)
{
if (window.RT) clearTimeout(window.RT);
window.RT = setTimeout(function()
{
this.location.reload(false); /* false to get page from cache */
}, 200);
});
翻译自: https://www.sitepoint.com/jquery-refresh-page-browser-resize/
jquery监听浏览器刷新
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/161187.html原文链接:https://javaforall.cn
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有