Google Drive offers 15 GB of secured storage online and can be used create secure online backups. It comes with limited storage but Unlimited Bandwidth and hence it can used as a host for your JS and CSS. Google also offers paid cloud solutions. If you need more storage, you can make use of this cloud platforms. The files are in Google’s high speed servers and hence we don’t need to worry about the downtime. Let us see the steps in using the Google Drive as a host for your static files.
Update: Google Drive host service had officially discontinued on August 31st 2016. Google Drive will still be running as usual. It is the Google Drive based web hosting feature that will not be operational. So this method won’t work.
This is not only for the CSS and JS. It can be used to host all type of files that Google supports. This includes all the Google documents, PDFs, Word documents, Zipped files, Photos, Video files and other Static files. This hosted files can be easily linked with Blogger, WordPress and other Websites. This will be very helpful for bloggers who are maintaining their blogs in Free services that do not offer file uploads and Google’s blogger is the example. So the files that has to be linked in Blogger Blogs can be uploaded in Google Drive and can be linked with blogger in its templates or directly in the Posts and Static Pages while creating them. Code to link the files are at the end of this post.
Adding Files to Google Drive
Adding files in to the Google Drive is as easy as adding files into the Folders in your computer. Login to your Drive using the Google account from drive.google.com Once you are logged in just drag and drop the files in to the desired folder or upload the using the uploader by clicking New button in the left side as shown.
Upload your files using the uploader or simply drag and drop the files inside the drive to upload. After uploading the file, you have to set the access to public or simply change the access of the folder to public in which you had uploaded your file. Check the screenshots below for reference. Right click the file and click Share or click the file and click the share button.
In the popup that appears click Advanced as shown here.
In the popup that appears again, click Change under “Who has access” as shown
Now in the next screen Click On – Public on the web, Select the Access type to Can View, then click Save as shown here.
You have now given Public access to your file. Anyone in the Internet can now access your file. Now copy the Link to share and get the file ID. This file ID has to be used in the Google Host URL.
This is the sharing link. The text in red is the file ID. You can use this file ID in the Google Hosting URL that looks like
https://googledrive.com/host/Your File ID here/ . Paste your ID and this is the URL for your file hosted in google. The URL looks like this.
This can be used to link the files in your websites. For example the CSS and JS can be linked to blogger blogs as follows. CSS can be directly added into the template easily. Read: Adding Custom CSS to blogger blog
The Code to link the CSS file is
<link rel="stylesheet" type="text/css" href="https://googledrive.com/host/0BwSlVrNXUFOSZWNnFieUViYXc/" />
The Code to link the JS file is
Other People are reading
- Good looking custom heading styles for your Website or blog using CSS
- Download YouTube Videos without using Softwares
- Backup WordPress Blog remotely in Google drive
- Creating Adsense Ad unit – Tutorial