<a target="_blank" id="mybutton" data-callback="myCallback" href="https://plus.google.com/share?url=http%3A%2F%2Fgoogle.com" data-onendinteraction="myCallback">Share on G+</a>
function start() {
// 2. Initialize the JavaScript client library.
gapi.client.init({
'apiKey': 'AIzaSyDDKX8UqKihNrjKYTt7DyiGNDSt-hC9src',
// Your API key will be automatically added to the Discovery Document URLs.
'discoveryDocs': ['https://people.googleapis.com/$discovery/rest'],
// clientId and scope are optional if auth is not required.
'clientId': '827352255313-h87u38in8jk064eduj5dhuk8h7qvcmng.apps.googleusercontent.com',
'scope': 'profile',
}).then(function() {
// 3. Initialize and make the API request.
return gapi.client.people.people.get({
'resourceName': 'people/me',
'requestMask.includeField': 'person.names'
});
}).then(function(response) {
console.log(response.result);
}, function(reason) {
console.log('Error: ' + reason.result.error.message);
});
};
// 1. Load the JavaScript client library.
function loadBTN(){
gapi.load('client', start);
gapi.plusone.render("mybutton",{
callback:function(jsonParam) {alert("URL: ");}
});
}
function myCallback(jsonParam) {
alert("URL: ");
}
Можно сказать тыкаю пальцем в небо. Ни один из alert не срабатывает.