Key method of rollMyFile API – given the URL to download a file and 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.

Parameters

ParamaterDescription
urlURL for the file to open.

This URL has to be accessible for rollApp to download the file for editing.
options
optional
Following are the available options:

name (optional) – explicit name of the file being opened
app (optional) – id of the app to open the file
onerror
optional
Called when attempt to open a file failed for any reason.
onsuccess
optional
Called after the file was opened successfully.

Usage

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("http://www.example.com/file/12345678",
                         {"name": "overview.docx"});

The example above will use default association of type of file to application, which is capable of handling such files. For instance, .docx files open in LibreOffice and .txt files open in Gedit. If you want to open .txt in LibreOffice writer, you can explicitly specify, which application to use:

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

For 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 callbacks to openFileByUrl.