location.href = location.href不会重定向 [英] location.href = location.href wont redirect
本文介绍了location.href = location.href不会重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的javascript代码中,在某些时候,我需要刷新窗口(用户已经上传了新图片但在页面中仍然可以看到它)
In my javascript code, in some point, i need to refresh the window (user has uploaded new image but in page still can see it)
我想知道为什么
location.href = location.href
没有刷新窗口?
推荐答案
如果您想要重定向您的页面,使用:
If you are wanting your to redirect your page, use:
window.location = location.href;
或者,如果是刷新页面的简单情况:
Or, if it is a simple case of refreshing the page:
window.location.reload();
这篇关于location.href = location.href不会重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文