google-ajax-api

To check favicon using Google API

倾然丶 夕夏残阳落幕 提交于 2020-01-04 06:28:38
问题 How can we check favicon provided by Google API is the default globe? https://www.google.com/s2/u/0/favicons?domain=facebook.com returns the favicon of the facebook , where as https://www.google.com/s2/u/0/favicons?domain=test.com returns the globe as the favicon. How can we check if the favicon is default globe or not? 回答1: I made a function a while back what checks if the default globe icon is returned. function getFavicon($domain) { $data = file_get_contents('https://plus.google.com/_

Can you load Google Maps API v3 via Google AJAX API loader

烈酒焚心 提交于 2019-12-20 10:11:17
问题 Some time ago I used the regular method of loading Google Maps API like this: <script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=abcdefg&sensor=true"> Later I switched to Google AJAX APIs to load Google Maps API. This was because a couple of "widgets" on my website needed the Google Ajax API loader so I chose to be consistent and used the AJAX APIs to load Google Maps as well: <script type="text/javascript" src="http://www.google.com/jsapi?key=abcdef"></script>

Is it ok to use google.setOnLoadCallback multiple times?

旧城冷巷雨未停 提交于 2019-12-18 04:42:23
问题 I'm building a site using ASP.NET MVC, and I have partial views that use jQuery to do various things. I was thinking of switching to Google's AJAX API and using their loader to load jQuery. However, I noticed that I would no longer be able to use $(document).ready() anymore because Google's loader specifies a callback google.setOnLoadCallback() . This is a little bit of a problem for me because I have $(document).ready() in various partial views because they do different things specific to

How does Google's javascript API get around the cross-domain security in AJAX

穿精又带淫゛_ 提交于 2019-12-17 22:42:19
问题 How does Google's API make cross-domain requests back to Google, when it's on your website? 回答1: They get around it by dynamically injecting script tags into the head of the document. The javascript that is sent down via this injection has a callback function in it that tells the script running in the page that it has loaded and the payload (data). The script can then remove the dynamically injected script tag and continue. 回答2: The accepted answer is wrong. Ben is correct. Below is the

Clean way in GWT/Java to wait for multiple asynchronous events to finish

徘徊边缘 提交于 2019-12-03 01:53:12
问题 What is the best way to wait for multiple asynchronous callback functions to finish in Java before continuing. Specifically I'm using GWT with AsyncCallback, but I think this is a generic problem. Here's what I have now, but surely there is cleaner way... AjaxLoader.loadApi("books", "0", new Runnable(){ public void run() { bookAPIAvailable = true; ready(); }}, null); AjaxLoader.loadApi("search", "1", new Runnable(){ public void run() { searchAPIAvailable = true; ready(); }}, null);

Can you load Google Maps API v3 via Google AJAX API loader

狂风中的少年 提交于 2019-12-02 21:14:09
Some time ago I used the regular method of loading Google Maps API like this: <script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=abcdefg&sensor=true"> Later I switched to Google AJAX APIs to load Google Maps API. This was because a couple of "widgets" on my website needed the Google Ajax API loader so I chose to be consistent and used the AJAX APIs to load Google Maps as well: <script type="text/javascript" src="http://www.google.com/jsapi?key=abcdef"></script> <script type="text/javascript"> google.load("maps", "2", {"other_params": "sensor=true"}); </script> Now

Clean way in GWT/Java to wait for multiple asynchronous events to finish

淺唱寂寞╮ 提交于 2019-12-02 15:30:19
What is the best way to wait for multiple asynchronous callback functions to finish in Java before continuing. Specifically I'm using GWT with AsyncCallback, but I think this is a generic problem. Here's what I have now, but surely there is cleaner way... AjaxLoader.loadApi("books", "0", new Runnable(){ public void run() { bookAPIAvailable = true; ready(); }}, null); AjaxLoader.loadApi("search", "1", new Runnable(){ public void run() { searchAPIAvailable = true; ready(); }}, null); loginService.login(GWT.getHostPageBaseURL(), new AsyncCallback<LoginInfo>() { public void onSuccess(LoginInfo

Is it ok to use google.setOnLoadCallback multiple times?

巧了我就是萌 提交于 2019-11-29 06:27:11
I'm building a site using ASP.NET MVC, and I have partial views that use jQuery to do various things. I was thinking of switching to Google's AJAX API and using their loader to load jQuery. However, I noticed that I would no longer be able to use $(document).ready() anymore because Google's loader specifies a callback google.setOnLoadCallback() . This is a little bit of a problem for me because I have $(document).ready() in various partial views because they do different things specific to themselves that I don't want the parent view to be aware of. Can I specify multiple callbacks and just

How does Google's javascript API get around the cross-domain security in AJAX

一笑奈何 提交于 2019-11-28 19:41:42
How does Google's API make cross-domain requests back to Google, when it's on your website? They get around it by dynamically injecting script tags into the head of the document. The javascript that is sent down via this injection has a callback function in it that tells the script running in the page that it has loaded and the payload (data). The script can then remove the dynamically injected script tag and continue. The accepted answer is wrong. Ben is correct. Below is the actually iframe node pulled off a page using the Google API JavaScript Client . <iframe name="oauth2relay678" id=

google.setOnLoadCallback with jQuery $(document).ready(), is it OK to mix?

亡梦爱人 提交于 2019-11-27 06:35:50
I'm using Google Ajax API and they suggest I use google.setOnLoadCallback() to do various things related to their API but I'm using also jQuery's $(document).ready() to do other JS things, not related to Google API. Is it safe to mix these two approaches in one document? I did not notice any problems yet but I suppose it's a matter of scale. cletus You pretty much have to do this: google.setOnLoadCallback(function() { $(function() { // init my stuff }); }); You can't do $(document).ready() without $ (the jQuery object) being available, so that needs to go inside the callback. And you can't be