Frage

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

War es hilfreich?

Lösung

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();
});
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top