At the moment, they've gotten rid of the ability to preview HTML files from the Drive interface, but you can still view or host HTML files that are in public folders as follows:
- Open the (publicly shared) folder you want to share from the Google Drive interface.
- Identify the folder URL in your address bar. It'll look something like
https://drive.google.com/?authuser=0#folders/0B81vQexWOx6hRDVMQWZTekx4Umc
- Replace
https://drive.google.com/?authuser=0#folders/
with "googledrive.com/host/"
- Your new URL will look something like this:
http://www.googledrive.com/host/0B81vQexWOx6hRDVMQWZTekx4Umc
If you have an index.html
file, this link will take you to the live page, otherwise, you'll be taken to the folder's public HTML view.
If you want to view a specific file in the folder, you can add its filename to the end of the URL like this: http://www.googledrive.com/host/0B81vQexWOx6hRDVMQWZTekx4Umc/chromedock.html
These links will be publicly usable.
I created a bookmarklet to automate the process of finding the public links for files and folders. Feel free to create a new bookmark (call it something like "Host from Google Drive") and paste the following code in as the URL:
This is an updated version of the bookmarklet that works with Google Drive's new folder URL structure.
javascript:var fOlDeR_URL = ""; fOlDeR_URL += document.location; fOlDeR_ref = fOlDeR_URL.split("/"); cLeAn_URL = "http://www.googledrive.com/host/"; cLeAn_URL += fOlDeR_ref[fOlDeR_ref.length-1]; nEw_URL = cLeAn_URL+"/"+prompt("To view the public HTML version of a file within this folder, enter its filename (such as mypage.html) below and hit enter.\n\nTo view the public HTML version of this entire folder (or its index.html, if it exists), just hit enter and you'll be directed to:\n\n"+cLeAn_URL,""); window.open(nEw_URL);
Once you have it bookmarked, just go to the folder you want the public URL for in Google Drive and click the bookmark.
Step 3: The URL is not edittable. Has this changed then since the answer was posted? – Russ Bateman – 2014-12-16T17:05:21.703
1If you're doing the three steps, you just change the URL directly from your address bar. Delete the part that says
https://drive.google.com/?authuser=0#folders/
and typegoogledrive.com/host/
instead. It's as editable as any URL. If you're using the bookmarklet, there's no need to edit the URL, since it does it for you. – gwistix – 2014-12-19T18:40:51.0431One other thing to note: it looks like they've changed the URL file structure, so this now only works for folders inside your main Google Drive folder; it no longer works for folders nested within other folders :( – gwistix – 2014-12-19T18:42:13.290
Actually, it does still work, but you have to replace everything before the final slash, rather than just the
https://drive.google.com/?authuser=0#folders/
part.For example, I have a nested folder with URL
https://drive.google.com/drive/#folders/0B81vQexWOx6hSkRCSk9fY2dSSEE/0B81vQexWOx6hRDVMQWZTekx4Umc
. My new URL will behttp://www.googledrive.com/host/0B81vQexWOx6hRDVMQWZTekx4Umc
.It seems like they're trying more and more to phase this kind of thing out, though. – gwistix – 2014-12-19T18:51:46.120
1I've rewritten the bookmarklet to work with the new folder URL structure, and put the new one in the original posting above, if you're interested. – gwistix – 2014-12-19T18:59:48.770
2Thank! Sadly, it only works in a publicly shared folder. My company use Google Drive and I'd like to share HTML files containing restricted information. I can do this in a presentation, spreadsheet, form, drawing, etc., but I cannot post an HTML document to be rendered by the browser except through this mechanism. Alas. – Russ Bateman – 2014-12-19T22:42:17.217