tıklattığınızda Google Plus geri arama işlevini aramak istiyorum Projemde [CodeIgniter] yerleşik bir Google Plus düğmesi kullandım. Burada aşağıdaki kodu ekledim.Google Plus düğmesini
<span id="signinButton">
<span
class="g-signin gooConnect"
data-callback="signinCallback"
data-clientid="my_project_client_id"
data-cookiepolicy="single_host_origin"
data-requestvisibleactions="http://schemas.google.com/AddActivity"
data-scope="https://www.googleapis.com/auth/userinfo.email">
</span>
</span>
Ardından, Google tarafından sağlanan Javascript kodunu ekledim.
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/client:plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
function signinCallback(authResult) {
if (authResult['access_token']) {
$.ajax({
url:base_url+'index.php/user/getUserProfile',
type:'POST',
data:{'access':authResult['access_token']},
beforeSend : function(){
$("#loadingImageBeforeResult").show('slow');
},
success : function(resp){
$("#loadingImageBeforeResult").hide('slow');
if(resp == 'exist'){
window.location.href=base_url+'index.php/user/my_deals';
} else {
$('#link_for_geniepage').trigger('click');
}
},
error : function(resp){}
});
} else if (authResult['error']) {
// There was an error.
// Possible error codes:
// "access_denied" - User denied access to your app
// "immediate_failed" - Could not automatially log in the user
// console.log('There was an error: ' + authResult['error']);
}
}
</script>
Benim için iyi çalışıyor, ama ben o zaman ayrı bir sekmede Gmail hesabımda oturum ve eğer Gmail kimlik bilgileriyle benim giriş sayfasında, geri çağırma işlevi sadece oto oturumların gidip kontrol paneline beni yönlendirir .
Bu Google Plus düğmesini tıklamadıkça, geri arama işlevinin çalışmaması gerekir. Bunu nasıl yapabilirim? Lütfen bana yardım et.
ve içinde imzalanması konusunda, geri eski sekmesine getirir, ancak bunu aynı sekmede görüntülenmesini istediğiniz? –
@ aritra-chakraborty PHP ile ilişki görmediğim için, sorunuzu yeniden etiketledim. – SteAp
tamam ... teşekkür ederim @SteAp ... lütfen bunu nasıl yapabilirim söyler misiniz? – ABorty