简体   繁体   English

页面重定向后单击浏览器后退按钮后上一页未加载

[英]Previous page not loading after clicking browser back button after a page redirection

From a sign up success thanks page I am redirecting to another webpage using window.location object.从注册成功感谢页面,我使用 window.location 对象重定向到另一个网页。 But after redirecting, clicking browser back button shows the sign up page not the sign up success thanks page.但重定向后,单击浏览器返回按钮显示注册页面而不是注册成功感谢页面。 Tried the same scenario without pressing the back button instead used window.history.go(-1) , this works fine it loads the success thanks page itself.在不按后退按钮的情况下尝试了相同的场景,而是使用了 window.history.go(-1) ,这很好,它加载了成功感谢页面本身。

Use window.location.href = 'YOUR LINK'使用window.location.href = 'YOUR LINK'

Right now, you are replacing the current page url (success page) with the new page (redirected page), so when you go back you go to the previous page in the history stack, which is the sign up page.现在,您正在用新页面(重定向页面)替换当前页面 url(成功页面),因此当您返回时,您会转到历史堆栈中的上一页,即注册页面。

You can also use history.pushState() to add entries to the location history您还可以使用history.pushState()将条目添加到位置历史记录

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 不允许将CSS携带到上一页(单击浏览器后退按钮后) - Not allowing CSS to be carried to previous page (after clicking browser back button) 付款后在浏览器中单击后退按钮可返回到其他页面 - Return to different page when clicking back button in browser after payment 得到确认页面后点击浏览器返回按钮 - Clicking the browser back button after getting the confirmation page 在特定页面上单击浏览器后退按钮后如何重定向到主页 - How to redirect to home page after clicking browser back button, when on a particular page 单击浏览器的“后退”按钮时,返回上一页的上一个位置 - Go Back to the Previous Location on Previous Page when Clicking Browser Back Button 在angularjs应用程序中注销后,如何通过浏览器后退按钮禁止用户访问上一页? - How to disable users from accessing previous page by browser back button after logout in angularjs application? 在angular2中注销后,如何通过浏览器后退按钮禁止用户访问上一页? - How to disable users from accessing previous page by browser back button after logout in angular2? 通过单击后退按钮重新加载上一页 - Reload the previous page by clicking the back button 单击浏览器后退按钮时如何转到当前页面的上一页 - How to go previous page of current page , while clicking browser back button 单击浏览器后退按钮时,将用户带回上一页滚动到的位置 - Take User Back to Where They Scrolled to on previous page when clicking Browser Back Button
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM