Pregunta

If you work with Google Docs your first file format is .gdoc / .gsheet / .gwhatever

What I want to understand is, how this file format works. When you open a .gdoc you basically open the browser and go to a specific URL. So is a .gdoc just a .html-file with a changed file extension?

I would like to build something similiar: A rich-text-editor which saves the content in my own file format, that you can download and if you open the file, the browser opens and links to a specific URL.

BTW: I opened a .gsheet in a text editor and found this source code:

{"url": "https://docs.google.com/a/test.com/spreadsheet/ccc?key=01234567898765432123456789&usp=docslist_api", "resource_id": "spreadsheet:0A12345B678HJK9TZPL9078767"}

*Changed the URL a bit ;)

¿Fue útil?

Solución

.gdoc and .gsheet files don't contain html, but JSON. These extensions are usually linked to the Google Drive application, which just reads the file and opens the URL with your standard browser.

If you're going to implement something like this yourself, you can go the same route: let the user install a program that handles your own files and start e.g. the browser.

Another way is to just use standard shortcuts; or use can use html files (maybe with another file extension if you link this extension to the standard browser) which just redirects to your target url.


in response to your comments:

to create a simple shortcut, you'll have to generate a file with the following content:

[InternetShortcut]
URL=your.url.com

and save it as YourFileName.YourExtension.url. Note that the "real" file-extension is .url. When saved to disk, windows explorer will usually hide the .url part (regardless of the Hide known file types setting). When the user starts this file, it will just open your.url.com. Chrome provides an API to create and save files client-side, but I don't know about other browsers. Probably you'll have to use a third-party library for creating the files (if you want to do this client-side).

Note this is a Windows-only solution. I don't know how you would handle this on Mac OS.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top