2014-11-27 1 views
0

내 웹 사이트에 google + login을 적용하고 있습니다. 나는 데이터베이스에 저장 내 서비스에 데이터를 보낼 때 그러나 그것은 나에게 다음과 같은 오류를 제공합니다 :google + login 오류. 원산지가 "http : // localhost"인 프레임을 차단했습니다.

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.

내 코드입니다 :이 기능은 텍스트 상자에 값을 채 웁니다. 값이 올바르게 채워지고 있습니다.

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

그래서, 당신이 사용하고있는 프로토콜을 변경하여 오류 메시지로 클릭 - 제출 버튼을

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"); 
    } 
    }); 
} 
+1

와우, 정말로 사람들은 여전히'alert'를 사용하여 자바 스크립트를 디버깅합니까? –

+0

질문하지 않은 것 같습니다. 오류 메시지를 인용했지만 그 오류는 사용자가 수행해야 할 작업을 정확하게 알려줍니다. – Quentin

+0

@AntonioRagagnin - 명백하고 차단되므로 유용합니다. – Quentin

답변

1

를 호출 할 때

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']); 
} 
} 

이 기능은 말한다 오류가 있습니다.

관련 문제