简体   繁体   中英

Redirect to previous page not working

i have used windows.history.back() to return user to previous page. now this command is not working but when i put debugger and do debug then page is getting redirect to previous page. but without debugging in firebug it is not working .
i have also tried windows.go(-1) . and even i tried all this option after clearing cache. still not working can anyone tell me what is problem? or give me alternative way to get browser back button functionality using java script/J Query or asp.net c#.

只需尝试使用html按钮而不是asp.net按钮或在JavaScript末尾添加return false可能是服务器端单击被调用

You can use C# Coding also for it.

On Button click

if (Request.UrlReferrer != null)
{
Response.Redirect(Request.UrlReferrer.ToString()); 
}

Which control are you using to write code to previous page.

If you're using Asp:Button 
write the javascript code on onclientclick event 
window.history.go(-1)

If you're using Html button 
write the javascript code on onclick event 
window.history.go(-1)

If you're using anchor tag <a> 
write the javascript code to href attribute
<a href="javascript:window.history.go(-1);">

尝试这个

 onclick="window.history.go(-1)"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM