最近碰到一个问题:在js中使用
window.location=window.location
刷新页面的时候会出现做完几步操作以后刷新页面的按钮失效的情况.经排查是url后面的"#"在作祟.
解决方法
function refreshThisWindow() {
var str = window.location.toString();
if (str.lastIndexOf('#') != -1) {
str = str.substring(0, str.length-1);
}
window.location=str;
}
window.location=window.location
刷新页面的时候会出现做完几步操作以后刷新页面的按钮失效的情况.经排查是url后面的"#"在作祟.
解决方法
function refreshThisWindow() {
var str = window.location.toString();
if (str.lastIndexOf('#') != -1) {
str = str.substring(0, str.length-1);
}
window.location=str;
}
本文介绍了一个JavaScript中的页面刷新问题:当URL包含特定字符时,刷新功能可能失效。文章提供了一种解决方案,通过移除URL中的特定字符来确保刷新功能正常工作。

101

被折叠的 条评论
为什么被折叠?



