禁用浏览器中的后退按钮
我有一个带有框架的网站。单击一个框架中的按钮会更新要在其他框架中加载的页面。现在,当用户按下后退按钮时,很少有框架会加载以前的页面。我希望用户不要返回到上一页。 我在所有页面的 onload 事件上使用了代码 History.forward() 。 当按下背部时,此功能很好用。用户始终导航到最近的页面。 但情况是假设用户通过单击第一框架中的按钮导航到页面数,该按钮更新要在其他框架中加载的页面。导航用户从浏览历史列表中选择一个页面后,它只会前进到一个页面,而不是他正在查看的最后一个页面。 这发生在 IE 中。 在火狐浏览器中它工作正常。用户可以从浏览历史记录中选择任何页面,他会被重新定位到最近的页面
I have a website having frames. Clicking on button in one frame updates the pages to be loaded in other frames. Now when user press the back button few of the frames load previous pages. i want user not to move back to previous page.
I used the code history.forward() on onload event of all my pages.
This works fine when back is pressed. User got navigated to most recent page always.
But the case is suppose user navigate to number of pages by clicking on button in first frame which updates the pages to be loaded in other frames. After navigation user select a page from the list of browsing history, then it is move forward to only one page, not the last page he was viewing.
This Happens in IE.
In firefox it works fine. User can select any page from the browsing history, he is relocated to most recent page
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的意见是,您应该检查您的概念,因为您想“重新配置”浏览器的导航按钮。在我看来,禁用浏览器功能已经过时了。
尝试按照以下方式操作:
在head部分中,插入javascript:
然后在
onload
事件中替换:history.forward()
通过history.go(historySize - 1)
。正值意味着向前移动到浏览器历史对象(数组)中的特定位置。我不能保证它会起作用,但值得尝试。
My opinion is, you should review your concept, because you want to "reconfigure" the browser's navigation buttons. Disabling browser features is in my eyes old fashioned.
Try following this way:
In the head section, insert the javascript:
Then replace in
onload
event:history.forward()
byhistory.go(historySize - 1)
. A positive value means move forward to a particular position in browser's history object (array).I cannot guarantee that it will work, but it is worth to try out.
将此代码写入脚本标签之间
write this code between script tags