gpt4 book ai didi

javascript - 谷歌+登录错误。阻止了来源为 "http://localhost"的帧

转载 作者:行者123 更新时间:2023-12-03 11:19:51 25 4
gpt4 key购买 nike

我正在我的网站中应用 google+ 登录。但是当我将数据发送到我的服务以将其保存在数据库中时,它会给出以下错误:

Uncaught SecurityError: Blocked a frame with origin "http://localhost" from accessing a frame with origin "https://apis.google.com". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "https". Protocols must match.

我的代码是:这个函数填充文本框中的值。并且值被正确填充。

function signinCallback(authResult) {
if (authResult['status']['signed_in']) {
gapi.client.load('plus', 'v1', function() {
var request = gapi.client.plus.people.get({
'userId': 'me'
});
request.execute(function(resp) {
var googleId = resp.id;
var name=resp.displayName
isGoogleSignUp(googleId, function(res) {
if (res) {
window.location = "profile.php";
} else {

$("#loginPopup").css("dispaly", "none");
$("#signupPopup").css("display", "block");
$("#socialName").val(name);
//$("#socialMail").val();
$("#socialId").val(googleId);
$("#socialType").val("google");
}
});
console.log(resp);

});
});
} else {
console.log('Sign-in state: ' + authResult['error']);
}
}

通过单击提交按钮调用此函数时会出错 -

function socialSignUp1() {
var urlString = "Service/socialSignup.php";
var form = new Object();
form.socialId = $("#socialId").val;
console.log(form.socialId);
form.type = $("#type").val();
form.name = $("#socialName").val();
form.mail = $("#socialMail").val();
form.phone = $("#socialPhone").val();
form.address = $("#socialAddress").val();
$.ajax({
type: 'POST',
data: form,
url: urlString,
success: function(resultData) {
if (resultData == 1) {
window.location("profile.php");

}
},
error: function(resultData) {
alert(resultData);
},
failed: function() {
alert("hello");
}
});
}

最佳答案

正如您的错误消息所示:

The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "https". Protocols must match.

因此,请更改您正在使用的协议(protocol)。

关于javascript - 谷歌+登录错误。阻止了来源为 "http://localhost"的帧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27170021/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com