我尝试通过一些过程在外部javascript文件中使用此语句刷新页面。
window.location.href = window.location.href
它完美地重新加载了页面,但是我想在重新加载后滚动到特定位置。因此,我将其放在页面上。
<a name="uploadImgSection"></a>
并将javascript更改为
window.location.href = window.location.href + "#mypara";
此代码也不会重新加载/刷新页面
window.location.hash = "#uploadImgSection";
window.location.href = window.location.href;
当我这样做时,它根本不会重新加载页面。有什么办法可以用滚动条位置重新加载页面?