繁体   English   中英

页面重新加载回到index.php

[英]Page reload goes back to index.php

我在网站上使用此脚本:

<script>
//refresh the page once to load slideshow correctly
setTimeout(function(){
    if(!window.location.hash) {
        window.location = window.location + '#loaded';
        window.location.reload()}}, 1000);
</script>

执行时,当前URL( http://.../slider/Cycle2/cycle2-tile.php?selection=3%2C4)不会重新加载并附加'#'而是index.php( (http://.../#loaded) )已加载。 为什么会发生这种情况,我该如何解决?

你可以试试这个吗?

<script>
//refresh the page once to load slideshow correctly
var currentLocation=window.location.href;
setTimeout(function(){
    if(!window.location.hash) {
        window.location = currentLocation + '#loaded';
        window.location.reload()}}, 1000);
</script>

您的意思是: window.location.href = window.location.href + '#loaded'; 而不是window.location = window.location + '#loaded';

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM