Pergunta

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

Foi útil?

Solução

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();
});
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top