app.js JavaScript API on Google Drive - javascript

I'm investigating Google Drive's real-time API. In the QuickStart Tutorial the JavaScript library loaded is https://apis.google.com/js/api.js. The Drive documentation describes this library as the Google JavaScript API loader. This library seems to load the appropriate libraries for the services we need to interact with.
But when looking at QuickStart Tutorial for Google Drive (non realtime) it seems to load https://apis.google.com/js/client.js which I believe is the library documented here.
My question is what is the difference between api.js and client.js. They seem to have similar purpose although don't work in the same way. Is api.js for certain Google API's while client.js is for others? Is api.js documented somewhere like client.js is?

The content of those two files are (nearly) identical, and in fact it seems you can put any name before .js and it will load the same file. That said, I'd recommend sticking with the file names shown in the documentation, as those are guaranteed to work.

Use links only from the documentation!
Simple to check this:
1) Add to header of your page this script:
<script type="text/javascript" src="https://apis.google.com/js/client.js"></script>
Open DevTools -> Network
I see:
2) Change link to other script
<script type="text/javascript" src="https://apis.google.com/js/api.js"></script>
Open DevTools -> Network
I see:
api.js is the core, when client.js is the module.
Here a completely different content: https://apis.google.com/js/platform.js
Additional information: https://stackoverflow.com/a/33281791/5754223

Related

Where to upload javascript file online and how to source it properly?

I'm trying to find how where and how to upload my scripts where I can source them as an external script.
I can't seem to find any question like this or maybe I'm not good enough in searching
But anyway, my situation is, I need to upload script online, a basic document.write to save space.
It cannot be a file on the same folder of storage as my pages because it's for work, and pages should be shareable to people as a standalone file so they don't have to extract it anymore.
Now I have tried to upload it online on different types of cloud or host, but I can't source it, because of security purposes I think?
Or maybe the source tag I should use must be different if it's online?
is it not <script type="text/javascript" src="https://abc.blabla.com/files/includes/html/page-links.js"></script>
Please please help. The main goal I have here is to upload my scripts online, and be able to source it as an external script on my "static and local website"
Thank you,
Renz
You probably are getting into to issues in most browsers when trying to load javascript from one domain (your-website.com) to another (localhost).
https://en.wikipedia.org/wiki/Cross-origin_resource_sharing
You can try loading your browser with CORS disabled (Chrome):
Disable same origin policy in Chrome
Or with a plugin such as these:
https://chrome.google.com/webstore/search/cors
You can do static hosting in firebase. once you host the files there then you can use the file link in script tag.
<script src="https://test.firebaseapp.com/file.js" ></script>

Service Worker with external links

I´ve got a project that have external URLs and internal URLs too. It´s build with React but the Service Worker seems to cache all internal links and that is ok, but when i want to go to the external URLs it doesn´t navigate to that links, not even when it´s working online.
Is there any way to do service worker functions with external URLs?
Thank you
Edit:
I found this on github made by GoogleChromeLabs that have the answer itself... Just have to install sw tools and use the options they give https://github.com/GoogleChromeLabs/sw-toolbox/blob/6e8242dc328d1f1cfba624269653724b26fa94f1/README.md#toolboxroutergeturlpattern-handler-options

I am trying to integrate Dropbox into my website. What does "curl" mean and how do I use it?

I went on the /list_folders method in the HTTP Developers guide (https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder) and it has "curl" as the example of how to use it. How do I put this in my HTML/JS code to pull in the folders? Thanks!
You can look at the reference for the JavaScript Dropbox library here which will guide you through creating a front-end website that utilizes the API. CURL is a very popular command line script used to transfer data over many supported protocols, but not something you can use from the browser.
More on the Dropbox API, this example Javascript script will show you how to list files.
The partial documentation can be found here.

Angulartics not tracking at all

I'm using angulartics for my application to track virtual page views on Google Analytics. This should be enabled by default but no visit to the page is tracked at all.
I should say that I wrapped the Google Analytics js code in a angular directive to be able to turn analytics off on my test server.
Otherwise its pretty standard, I included the angulartics source files in my index.html, added the module to my app.js and removed the ga('send', 'pageview') from the Google Code (as it is described in the docs).
I also found this hard to test. Should I see REST calls in the network console to verify its working? Because I'm not seing any (except the analytics code being loaded from the Google server).
Any idea what I am doing wrong?
Thanks,
Flosky
[edit]I should probably also mention that I'm using the angular ui router and not the default one[/edit]

jquery-1.11.2.min.js is not working in sliding menu

My code of sliding menu is not working in the project although i tested it on jsfiddle it is working there fine but it is not working in my project .actually the problem is in inclusion of file " jquery-1.11.2.min.js" i have also downloaded this file and included in my project and provided a path for the same but still it is not working this is the code for including the file am i doing anything wrong for including that file
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
this is the path in the directory of my project
<script type="text/javascript" src="../scripts/jquery-1.11.2.min.js"></script>
When using a Library like jQuery, it's highly recommended for performances purposes to use a link from the Google Hosted Libraries.
For Jquery 1.11.2, it's :
https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js
Why ? Because a lot of website import libraries from this link, so it's in the user local cache, and it will be load from local almost each time.
yes it shows error GET file://
When run locally src="// would default to the local file:// protocol which will not work.
Use src="https://code.jquery.com/jquery-1.11.2.min.js"

Categories

Resources