我在我的网站中使用此脚本:
<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>
执行时,当前网址(http://.../slider/Cycle2/cycle2-tile.php?selection=3%2C4)
)未被真实加载并附加&#39;#&#39;但是加载了index.php((http://.../#loaded)
)。为什么会发生这种情况,我该如何解决?
答案 0 :(得分:1)
你能试试吗?
<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>
答案 1 :(得分:0)
你的意思是:
window.location.href = window.location.href + '#loaded';
代替
window.location = window.location + '#loaded';
?