open-url

This action opens a web page depending on the provided URL or deep links to an external app. open-url can be used in a list of actions, such as swipeable and rightElement, or with another action; after the main action is executed, open-url is called and opens the configured URL.

Configuration options

An open-url action can be set up in various ways:

  1. As a separate action or in the action list.

  2. As a swipeable action in the left or right direction.

  3. As rightElement in the list.

  4. As an associated action in the action list.

Core structure

title

Provide a title for opening the URL, you can use expressions in the title field.

url

Specify the URL you want opened. The following formats are supported:

https://

www. sitename.com external app link (See the deep link to an external app example)

Examples and code snippets

open-url as an action

Open URL
Open URL

The simplest example of using an open-url action is to use it as a separate action. Thanks to this, a button will appear at the bottom, which, when pressed, will open the specific URL that we set up.

Example: See the full example in <GitHub.

actions:
  - children:
      - type: action.open-url
        options:
          title: Jigx Documentation
          url: https://docs.jigx.com/examples/readme/actions/open-url

open-url swipeable left/right

Swipe to open URL
Swipe to open URL

This example uses the open-url action as a swipeable property. We can choose the swipe direction left or right. After pressing the button, it will open the specific url that we set up.

Example: See the full example in GitHub.

item:
  type: component.list-item
  options:
    title: [email protected]
    subtitle: [email protected]
    leftElement: 
      element: avatar
      text: " "
      uri: [email protected]
    swipeable:
      left:
        - label: Open Url 
          onPress:
            type: action.open-url
            options:
              url: https://docs.jigx.com/examples/readme/actions/open-url
      right:
        - label: Open Url 
          onPress: 
            type: action.open-url
            options:
              url: https://docs.jigx.com/examples/readme/actions/open-url

open-url rightElement

Button to open URL
Button to open URL

In this example, we use the open-url action as the rightElement in the list-item component. There is a button for each item.

Example: See the full example in GitHub.

item:
  type: component.list-item
  options:
    title: [email protected]
    subtitle: [email protected]
    leftElement: 
      element: avatar
      text: " "
      uri: [email protected]
    rightElement: 
      element: button
      title: Open
      onPress:
        type: action.open-url
        options:
          url: https://docs.jigx.com/examples/readme/actions/open-url

open-url onSuccess

Open URL onSuccess
Open URL onSuccess

n this example, the open-url action is associated with the submit-form action. After we enter the signature and press the "Sign" button, the submit-form action is performed and the specific url will be opened.

Example: See the full example in GitHub.

open-url-on-success.jigx
actions:
  - children:
      - type: action.action-list
        options:
          title: Sign and go to documentation
          isSequential: true
          actions:
            - type: action.execute-entity
              options:
                provider: DATA_PROVIDER_DYNAMIC
                entity: default/form
                method: create
                data:
                  signature: [email protected]
                onSuccess: 
                  title: Succesfully signed
                  actions:
                    - type: action.open-url
                      options:
                        title: Open the documentation
                        url: https://docs.jigx.com/examples
            - type: action.go-back

In this example, the action.open-url is used with a deep link that opens the Google Maps app to a specific location. There are two code examples, one for iOS and the other for Andriod.

Open Google Maps
Open Google Maps
title: Zoos in the USA
type: jig.default

actions:
  - children:
      - type: action.open-url #iOS
        options:
          title: Directions
          # Add the external app's iOS deep link in the url    
          url: comgooglemaps://?center=32.7347483943,-117.150943196&zoom=14
    
children:
  - type: component.image
    options:
      source:
        uri: https://c8.alamy.com/comp/2GFT773/san-diego-california-25-aug-2021-san-diego-zoo-main-entrance-in-balboa-park-2GFT773.jpg
  - type: component.entity
    options:
      children:
        - type: component.entity-field
          options:
            label: San Diego Zoo
            value: The San Diego Zoo is 100 acres in size. It is well known for its lush, naturalistic habitats and unique animal encounters and is home to more than 3,700 rare and endangered animals representing approximately 660 species and subspecies and a prominent botanical collection with more than 700,000 plants.

Last updated

Was this helpful?