How to add video call to my website using Google Hangouts API? - google-api

I want to add video call to my website using hangouts api. I referred the Google Hangouts button documentation and my code is :
<script src="https://apis.google.com/js/platform.js" async defer></script>
<div id="placeholder-div"></div>
<script>
gapi.hangout.render('placeholder-div', { 'render': 'createhangout' });
</script>
It's not loading anything.

Related

recaptcha.net which Google suggested also is not working in China

Google suggests recaptcha can be used globally using recaptcha.net, but when I followed the steps and implemented it on a site it is not even loading. Any suggestions/help?
https://developers.google.com/recaptcha/docs/faq
First replace <script src="https://www.google.com/recaptcha/api.js" async defer></script> with <script src="https://www.recaptcha.net/recaptcha/api.js" async defer></script>

Can't get Google Calendar to populate FullCalendar

I'm new to programming so please excuse the improper terminology, but I was able to get a basic FullCalendar added to my website and would like to populate the calendar based on one of my public Google Calendars. I followed the steps on FullCalendar's website for setting up Google Calendar but I still just see a blank calendar, even though there are events on the public Google Calendar. The only step I was unsure of when setting things up was the Authorized JavaScript Origins section of setting up the Google API. I am using a GitHub pages site and it would not accept the full path name for my site so I just put the main hub portion (https://username.github.io) in this Authorized JavaScript Origins field. Is this incorrect? What needs to go in this path if I am using the FullCalendar on a site with the following type of URL: https://stephmorgan.github.io/repository/ ?
<head>
<link rel="stylesheet" href="fullcalendar/fullcalendar.css" />
<script src="lib/jquery.min.js"></script>
<script src="lib/moment.min.js"></script>
<script src="fullcalendar/fullcalendar.js"></script>
<script src="fullcalendar/gcal.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#calendar").fullCalendar({
googleCalendarApiKey: "<API-KEY>",
events: {
googleCalendarId: "b3eki2m39g1lcfcq3nnl1vb9lo#group.calendar.google.com"
className: "gcal-event"
}
});
});
</script>
</head>
<body>
<div id="calendar"></div>
</body>
There are several problems:
1) googleCalendarId: "Calendar ID: b3eki2m39g1lcfcq3nnl1vb9lo#group.calendar.google.com" should be googleCalendarId: "b3eki2m39g1lcfcq3nnl1vb9lo#group.calendar.google.com", as per the example at https://fullcalendar.io/docs/google_calendar. It thinks "Calendar ID: " is part of the ID, which obviously it isn't, and Google won't recognise it.
2) The same issue with the API Key - remove the < and > from the ends of the string.
3) It sounds like you chose the wrong kind of credentials - the API key config does not contain a section from JavaScript origins etc. You must choose to create an API Key (sometimes called a Browser Key), and not Oauth Client ID or Service Account.

Copying AdSense on page using jQuery - is it against AdSense rules?

I need loading Google Adsense Ads with AJAX. I found, that it's not allowed at this time, so I was thinking and invet this:
I normally include Google javascript code into HTML page in DIV with some ID like:
<div id="google_ad">
<script>
google_ad_client = "ca-pub-XXXXXXXXXXXXXXXXXXXX";
google_ad_slot = "XXXXXXXXXXX";
google_ad_width = 300;
google_ad_height = 250;
</script>
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
And then, when I'm loading new content via AJAX, I create new DIV with some CLASS and then copy content of into every like this:
$('#content').append($('<div>').load('http://www.foo.com/load.php'), function(){
$('.google_ad').html($('#google_ad').html());
}));
Do you thing that it's ok or it's against Google AdSense rules?
Thank you for your answer.
I am an Adsense publisher since 2006, your ajax trick looks cool. So you mean your full and unaltered Google adsense code is inside the load.php file ?
According to this link (google forum) loading your Adsense code via ajax is same as loading your adsense code via IFRAME.
So to protect your adsense account, put your adsense code naturally.

Phonegap online method and window.location

I'm new to phonegap and I'm still trying to understand the basics. I want to make a simple app that when it starts up it checks to see if it has an internet connection and if it does I want it to redirect to a website or load that website in the web view. If it doesn't have an internet connection, then I want it to stay on the app and just display static content.
Here's what I have so far.
<!DOCTYPE html>
<html>
<head>
<title>Online Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.1.0.js"></script>
<script type="text/javascript" charset="utf-8">
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// Cordova is loaded and it is now safe to make calls Cordova methods
//
function onDeviceReady() {
document.addEventListener("online", onOnline, false);
}
// Handle the online event example
//
function onOnline() {
window.location.href ="http://google.com";
}
</script>
</head>
<body onload="onLoad()">
</body>
</html>
I also set OpenAllWhitelistURLsInWebView to true.
Does the online event only work if the app was offline then gets called when the app goes back online?
Thanks in advance!
No, Online event is fired when the app starts if internet is connected and it is also called when the app goes from offline to online mode.
If you want to open a external website in phonegap you can add a child browser plugin for the same Or else you can open a website in a embedded webveiw. window.location.href doesn't work in Phonegap.
I don't know whether you are working on iOS or Android so the link for iOS and for Android
Move your wiring up of the online event handler (i.e. this line):
document.addEventListener("online", onOnline, false);
up into your onLoad() function. I found that the online/offline events need to be registered on load, rather than later for some reason.

Load a page into an iframe with C# ASP.NET, Razor, and MVC3

I want to load an external page (i.e. google or facebook auth) into a iframe when the user clicks a button. How would you do this using MVC3 and Razor?
This seems like an extremely trivial task, but I can’t seem to figure out what to ask Google so I get something back I can use.
You could use JQuery something like this:
<script type="text/javascript">
$(function () {
$('#myButton').click(function () {
$('#myFrame').attr('src', 'http://www.google.com/');
});
});
</script>
<iframe id="myFrame"></iframe>
<button id="myButton">
Refresh IFrame
</button>
However, you will find that some sites (such as google.com) will prevent you from doing this, as they can specify in their response header whether or not the page can be opened in an IFrame. This is to prevent 'clickjacking' and is built in to most modern browsers.

Resources