js刷新当前页面的5种方式
warning:
这篇文章距离上次修改已过434天,其中的内容可能已经有所变动。
- 使用
location.reload():
location.reload();- 使用
location对象的方法,传入reload参数:
location = location;- 使用
location.replace()与自身页面进行替换:
location.replace(location.pathname);- 使用
location.href设置为当前页面的URL:
location.href = location.href;- 使用
location.assign()加载当前页面:
location.assign(location.href);
评论已关闭