简体   繁体   English

返回导航/页面刷新问题

[英]Back navigation / page refresh issues

I have a blog page (part of a slider) with a blogposts list on it. 我有一个博客页面(滑块的一部分),上面有博客文章列表。 I click on a post, it takes me to it, but if I try to go back (via browser's back button) to the blog list page, all i get displayed is the header and the background image. 我单击了一个帖子,它被带到了我,但是如果我尝试返回(通过浏览器的“后退”按钮)到博客列表页面,则显示的只是标题和背景图像。

After this, I press forward to return to the blog post (blog article) and if I press back again, it works. 此后,我按前进以返回到博客文章(博客文章),如果再次按回去,它将起作用。 My page gets displayed correctly without any problems. 我的页面正确显示,没有任何问题。

Does anyone know what can cause this? 有谁知道是什么原因造成的? I forgot to mention that my intention is to make it display correctly after the back button. 我忘了提及我的意图是使其在返回按钮后正确显示。

I tried using the onbeforeunload event: 我尝试使用onbeforeunload事件:

<script type="text/javascript">
     window.onbeforeunload = function () {
     return "You are about to leave this order form. You will lose any information...";
    }
</script>

on the blogposts page but to no avail. 在Blogposts页面上,但无济于事。

Does anyone know what causes this ? 有谁知道这是什么原因?

尝试这个

<a href="#" onclick="history.go(-1);">Back</a>

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

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