问题
I am trying to add a google hangout button to my html file as shown below but when I run the html page , the button does not show.
<!DOCTYPE html>
<html>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<div id="placeholder-rr"></div>
<script>
gapi.hangout.render('placeholder-rr', {
'render': 'createhangout',
'initial_apps': [{'app_id' : '184219133185', 'start_data' : 'dQw4w9WgXcQ', 'app_type' : 'ROOM_APP' }],
'widget_size': 175
});
</script>
</html>
回答1:
First please check if any errors showing up in browser console using f12 key when on browser and reload the page.
Try adding this script as well alongwith platform.js to the page you want the hangout button.
<script src="https://apis.google.com/js/client:plusone.js" type="text/javascript"></script>
Hope this helps
Example code:-
<div id="hangout-button-holder"></div>
<script src="https://apis.google.com/js/client:plusone.js" type="text/javascript"></script>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<script>
$(document).ready(function(){
gapi.hangout.render('hangout-button-holder', { 'render': 'createhangout', 'topic': 'Its a demo app dont freak out', 'hangout_type': 'onair', 'initial_apps': [{'app_id' : 'xxxxxxxxxxx', 'start_data' : 'dQw4w9WgXcQ', 'app_type' : 'LOCAL_APP' }],
'widget_size': 175 });
});
</script>
来源:https://stackoverflow.com/questions/29004114/google-hangout-button