停留在当前页面 [英] stay in a current page

查看:91
本文介绍了停留在当前页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何保留在当前页面中.即使用户单击返回,也应保留在当前页面中,而不是返回到旧屏幕?

how to stay in the current page..even when the user clicks back..it should stay in the current page instead of going back to the old screen??

推荐答案

看看我最近写的一篇文章

Web开发-禁用后退按钮 [
Have a look at an article I wrote recently

Web Development - Disabling the back button[^]

What you''re trying to do is wrong. You shouldn''t attempt to disable the back button using script, that will never work reliably and will just annoy your users


尝试使用此代码,它将禁用后退按钮不仅适用于firefox,而且适用于MSIE,Safari和Opera.
Try this code it will disable the back button not only in firefox but also in MSIE, Safari and Opera.
<html>
<head>
<script type="text/javascript">
window.history.forward();
function noBack(){ window.history.forward(); }
</script>
</head>
<body onload="noBack();" onpageshow="if (event.persisted) noBack();" onunload="">
...
</body>
</html>


否则,强制缓存过期以使其正常工作.将以下代码放在页面代码后面.


Or else force the cache to expire for this to work. Place the following code on your page code behind.

Page.Response.Cache.SetCacheability(HttpCacheability.NoCache)


这篇关于停留在当前页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆