View rendered html of html document in new Google Drive
In the old Google drive—before the material redesign—one could open an HTML document and that would show the source in a modal (pop-up window with an overlay behind it). Then when you pressed open from there, it rendered the html.
In the new Google drive can I view my HTML rendered in any way? In other words host a static website in Google Drive?
Right now it just lets me view the source or edit it with extensions. I want to view the render. The actual webpage.
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
- Your new URL will look something like this:
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.
It is possible to add the third party viewing/editing applications to Google Drive now. There is not lack in simple HTML viewers. Try to select "Open with", then "Connect more apps", then search for apps by typing "HTML" in the box provided. The app named (literally) "HTML viewer" serves me fine.
If you don't want to share your saved HTML documents publicly, and don't want to install a simple HTML viewer in google docs (they want access to your profile etc.), and are using MacOS or Windows, you can install a native drive app on your computer. Then you can open the files directly and preview them in your OS's browser. Was the best option for me, but certainly won't work for everyone.