【问题标题】:Request.UrlReferrer is not working in IE8 and working fine IE9Request.UrlReferrer 在 IE8 中无法正常工作,在 IE9 中工作正常
【发布时间】:2013-11-07 16:31:28
【问题描述】:

我的 ASP.NET MVC 页面上有关闭按钮。 我编写了以下代码以返回上一页。 它在 IE9 中运行良好,但在 IE8 中抛出错误。

 $('#Close').click(function () {
          window.location.href= '@Request.UrlReferrer';

        });

感谢您的回复。

谢谢

【问题讨论】:

  • 它会抛出什么样的错误?浏览器通常也有后退按钮。在你的 UI 中写这样的按钮有什么意义?
  • 不幸的是,有时客户只是想要这样。

标签: c# javascript jquery asp.net-mvc referrer


【解决方案1】:

HTTP 规范不要求引用者,因此您不能真正依赖它。不过你可以用这个

$('#Close').click(function () {
  window.history.back();
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-05-06
    • 2011-09-30
    • 2013-12-01
    • 2010-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-12
    相关资源
    最近更新 更多