Open URL Action

The action module for this action is "vb/action/builtin/openUrlAction".

In a web app, this action opens the specified URL in the current window or in a new window using the window.open() API.

In a native mobile app, this action supports opening local file attachments as well as remote resources. Allowed file types for the url parameter are as follows:

  • .pdf
  • .doc
  • .txt
  • .text
  • .ppt
  • .rtf
  • .xls
  • .mp3
  • .mp4
  • .csv

The very first time, the user will get an option to select which application to use for opening a given file type. If no application is available to open such a file, this action will fail with the appropriate error. Once the given file has been opened once, it will always be opened with the same application across all Visual Builder installed apps on the device.

If the specified file is not local or if the file extension is not recognized, this action will use Cordova's plugin cordova-plugin-inappbrowser to open the specified URL.

Parameter Name Description
url The url to navigate to (required)
params A key/value pair map that will be used as query parameters to the url (optional)
hash The hash entry to append to the URL. (optional)
history Defines the effect on the browser history. Allowed values are 'replace' or 'push'. If the value is 'replace', the current browser history entry is replaced, meaning that the back button will not go back to it. (optional, and default is 'push')
windowName A name identifying the window as defined in the window.open() API (optional). If not defined, the URL opens in the current window. Otherwise, refer to the window.open() API documentation. In a mobile app, there are 3 possible values: _self, _blank, or _system. The default is _self. Refer to the documentation for cordova-plugin-inappbrowser. For local file types, this parameter is ignored.

Once on the URL location, the browser back button will re-enter the last page if you specified a value for the windowName parameter that opens the URL in the current window and the page input parameters will be remembered, even if their type is 'fromCaller'.

Example 1-44 Open a new window in the browser with the given URL

To open a URL:

"myActionChain": {
  "root": "myAction",
  "actions": {
    "myAction": {
      "module": "vb/action/builtin/openUrlAction",
      "parameters": {
        "url": "http://www.example.com",
        "params": {
          "id": "{{ $page.variables.myId }}"
        },
        "windowName": "myOtherWindow"
      }
    }
  }
}