Search code examples
urlgoogle-colaboratory

Google Colaboratory URL scheme


I noticed a few changes in Colab URLs recently. Can someone confirm/clarify its correct meaning?

  • https://colab.research.google.com/notebook#fileId=xxx This is the original one, now not used much.
  • https://colab.research.google.com/notebooks/xxx.ipynb This is for official notebooks, such as welcome.ipynb and other examples for newcomers.
  • https://colab.research.google.com/drive/xxxxxx This is the most common scheme. It refers to a specific notebook in Google Drive by fileId.
  • https://colab.research.google.com/github/tensorflow/path/to/notebook.ipynb The newest one. It can refer to any notebook hosted on github.
  • https://colab.research.google.com/gist/yourname/xxxxxx/notebook.ipynb A notebook on GitHub Gist. You can save any Colab notebook there with Save a copy as a GitHub Gist... menu.

Am I missing any other URL scheme?

I am also curious about its URL parameters when you “Open in playground”:

  • forceEdit=true&offline=true&sandboxMode=true This is the default parameter setup. It seems to copy it to a temp file, then you can edit and run it without saving to your drive first.
  • I can also use just offline=true&sandboxMode=true, and it still works. So why `forceEdit=true’?
  • What’s the meaning of forceEdit, offline, and sandboxMode anyway?

update

The new sandbox scheme is just https://colab.research.google.com/drive/xxxxxxx#offline=true&sandboxMode=true


Solution

  • This is mostly correct- Colab is migrating away from the hashparam based URLs because they don't allow server-side redirects and the new ones are a bit cleaner.

    The #fileId=xxx scheme is still used when opening files from drive.google.com, but this will start using the new scheme soon as well.

    All old URLs will continue to work, but because of the server-side redirect we'd encourage using the new scheme.

    The playground parameters are crufty and will most likely be changed at some point.

    • forceEdit allows editing, even if the notebook is not editable (vs the readonly view)
    • offline disables realtime collaboration.