문제

I have Close button on my ASP.NET MVC page. I wrote the following code to go back to previous page. It is working fine in IE9 but throwing error in IE8.

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

        });

Appreciate your responses.

Thanks

도움이 되었습니까?

해결책

Referer is not required by the HTTP specification, so you can't really rely on it. You can use this though

$('#Close').click(function () {
  window.history.back();
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top