I tried to put header( 'Location: home.php' ) ; into the function login with facebook but after I successfully login, the page still doesn't redirect to homepage.
Anyone can help me out? Thanks!
function login(response, info){
if (response.authResponse) {
var accessToken = response.authResponse.accessToken;
userInfo.innerHTML = '<img src="https://graph.facebook.com/' + info.id + '/picture">' + info.name
+ "<br /> Your Access Token: " + accessToken;
button.innerHTML = 'Logout';
showLoader(false);
document.getElementById('other').style.display = "block";
header( 'Location: home.php' ) ;
}
}
You seem to be mixing up your PHP and JavaScript. Header is a PHP function. You can't use it with JavaScript.
You might want to try a JavaScript redirect method -
var homeUrl = 'home.php';
top.location.href = homeUrl;
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.