简体   繁体   English

用户注销后单击“后退”按钮时,如何重定向到首页?

[英]How can I redirect to home when user click on back button after logout?

I was wondering how can I redirect users to my hompage after they logged out when they hit the back button, kind of like facebook does. 我想知道如何在用户单击后退按钮后注销后将用户重定向到我的主页,就像在Facebook上那样。 I was playing around with some javascript but nothing seemed to work. 我在玩一些JavaScript,但似乎没有任何作用。

PS: This will be for a Wordpress theme. PS:这将是针对Wordpress主题的。

如果使用会话,则可以在查看经过身份验证的页面时检查用户是否已登录,如果没有,则将标题发送到您的主页。

Javascript seems like the way to do it. Javascript似乎是这样做的方法。 Simply check if the user is logged and if not, do a redirect to the home page via a document.location = "http://my.home.page"; 只需检查用户是否已登录,如果没有,则通过document.location =“ http://my.home.page”;重定向到主页。

I guess that you have the session in PHP too so you could just do the redirect there instead of relying on Javascript. 我想您也有使用PHP的会话,因此您可以在那里进行重定向,而不必依赖Javascript。

header ('Location: http://your.home.page');

嗨,在那里检查wp_logout_url($ redirect_url)

暂无
暂无

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

相关问题 Codeigniter:当用户注销后单击“后退”按钮时,如何重定向到首页? - Codeigniter: How can I redirect to home when user click on back button after logout? 单击浏览器的后退按钮时如何在主页上重定向 - how can i redirect on the home page when i click on browser's back button 注销后单击后退按钮重定向到网页 - Redirect to webpage by click on back button after logout 使用Instagram API注销后如何重定向到主页 - How we can redirect back to home page after logout with Instagram API 用户按下注销并销毁 session 后,如何禁用后退浏览器按钮? - How can I disable the back browser button after user press logout and destroy session? 如何在PHP注销后不允许用户返回? - How can I not allow a user to go back after logout in PHP? 登录后单击“后退”按钮,将登录的用户重定向到主页 - Redirect logged in user to home page when back button is pressed after login 在我的 php 项目中,当我点击注销时,我正在主页重定向,如果我点击后退按钮,我将返回帐户页面 - In my php project when I clicked on logout, I am redirecting at home page, and if I click back button I am getting back in account page 在提交按钮单击登录详细信息后如何将用户重定向到主页 - how to redirect user to the home page after login details on submit button click 注销后的Laravel 5重定向 - 如何重定向? - Laravel 5 Redirect After Logout - How to Redirect Back?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM