Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Dropbox Open button work?

In February 2015 Dropbox released a new feature that allowed you to trigger the local opening of a file from their web interface: https://blogs.dropbox.com/dropbox/2015/02/new-way-to-open-dropbox-files/

More information is here:

  • https://www.dropbox.com/en/help/8571
  • https://www.dropbox.com/help/8572

Here is an example of the Open button visible from the context menu:

enter image description here

And here is the brief display of the popup that is apparently connecting to the sync client:

enter image description here

It's clear that the Dropbox sync client must be installed, so you have some native local code running, which allows for some fancy stuff that would be impossible with just in-browser Javascript, but somehow the browser page is able to do some unexpected things:

  1. selectively display the Open button based on information from the sync client (whether it's on and whether the file exists locally)
  2. trigger, by clicking on the button, an action by the sync client (opening the file in its default app, or opening the folder in Explorer/Finder)

By what technical mechanism do these two things work?

like image 340
dlo Avatar asked Sep 10 '15 13:09

dlo


1 Answers

This is just a guess, but probably something like this:

  1. The sync client knows everything about local file existence.
  2. The sync client sends that info to the sync server, so the server knows too.
  3. The Dropbox web page can then selectively show the open button.
  4. Upon clicking the open button, the web page contacts the sync server, which in turn sends a message to the sync client to "open that file".
  5. The sync client opens that file. On a Mac this would be a simple open [path] shell command.

Nothing fancy in the browser.

like image 138
merikonjatta Avatar answered Sep 19 '22 03:09

merikonjatta