我使用的代码是-->
<div class="login">
<form method="POST">
<label for="chk" aria-hidden="true">Login</label>
<input type="email" name="login_email" placeholder="Email" required="">
<input type="password" name="login_password" placeholder="Password" required="">
<button type="submit" name="login">Login</button>
<div class="containergg">
<label1 for="signup">Or signin with:</label1>
</div>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<script>
function onSignIn(googleUser) {
// Extract necessary information about the user
var profile = googleUser.getBasicProfile();
var userEmail = profile.getEmail();
// Check if user is signed in with Google
if (userEmail) {
// Redirect to dashboard.php
window.location.href = 'dashboard.php';
} else {
// Handle the case where the user is not signed in
console.log('User not signed in.');
}
}
</script>
</form>
</div>
注册逻辑相同
我期待,登录后应该会带我到dashboard.php 文件。`
试试这个:
var url = "example.com";
window.open(url);