Open URL
The Open URL action is used to navigate to an external URL. 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 can open local file attachments as well as remote resources.
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:
.pdf
.doc
.txt
.text
.ppt
.rtf
.xls
.mp3
.mp4
.csv
The very first time, the user gets 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 fails with the appropriate error. After a file is first opened, 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.
This table describes the parameters for the Open URL action:
Parameter Name | Description |
---|---|
url | The URL to navigate to. |
params | A key/value pair map that will be used as query parameters to the URL |
hash | The hash entry to append to the URL. |
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. 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. The page input parameters will be remembered, even if their type is 'fromCaller'.
Here's an example of a call to the Open URL action, in which one parameter is passed:
await Actions.openUrl(context, {
url: $variables.urlToOpen_pv,
params: {
inParam: $variables.itemID,
},
hash: $variables.hashPart_pv,
history: 'push',
windowName: '_self',
});