Hey! These docs are for version 1.0, which is no longer officially supported. Click here for the latest version, 3.0!

Key method of rollMyFile API – given the URL to download a file open it online with one of the applications on rollApp.

rollMyFile.openFileByUrl("http://www.example.com/documentation/overview.docx");

With this call application will open in a separate window with the file loaded into it.

🚧

Pop-up Blocker

To prevent pop-up blocker from interfering with application launch this method has to be called from an event handler for click or key press.

More about pop-up blocker from Mozilla developers.

If you need better visibility into the result of the operation, for example, to show custom error message, when opening a file fails, you can supply onerror and onsuccess to openFileByUrl:

CallbackDescription
onerrorCalled when attempt to open a file failed for any reason.
onsuccessCalled after the file was opened successfully.

The application to open the file is determined using file name deduced from the URL. However, that would not work, if URL does not contain name of the file. In this case you can explicitly pass name of the file to openFileByUrl like this:

rollMyFile.openFileByUrl(
  {"url": "http://www.example.com/file/12345678",
   "name": "overview.docx"});