# open-url

This action opens a web page depending on the provided URL or [deep links](https://docs.jigx.com/building-apps-with-jigx/additional-functionality/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.

Some properties are common to all actions, see [Common action properties](/examples/readme/actions/common-action-properties.md) for the list of actions and their configuration options.

<table><thead><tr><th width="147.0703125">Core structure</th><th></th></tr></thead><tbody><tr><td><code>title</code></td><td>Provide a title for opening the URL, you can use expressions in the title field.</td></tr><tr><td><code>url</code></td><td><p>Specify the URL you want opened. The following formats are supported:</p><p>https://</p><p><a href="/pages/K1Hkb4X0FT4ehkzAPTI7">www</a>. sitename.com external app link (See the deep link to an external app example)</p></td></tr></tbody></table>

## Examples and code snippets

### open-url as an action

{% columns %}
{% column %}

<figure><img src="/files/oRrThXBULeNl6IOZ64fu" alt="Open URL" width="188"><figcaption><p>Open URL</p></figcaption></figure>
{% endcolumn %}

{% column %}
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](https://github.com/jigx-com/jigx-samples/blob/main/quickstart/jigx-samples/jigs/jigx-actions/open-url/open-url-action.jigx).
{% endcolumn %}
{% endcolumns %}

```yaml
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

{% columns %}
{% column %}

<figure><img src="/files/NJcEqiLptdAZvG4R1LQM" alt="Swipe to open URL" width="188"><figcaption><p>Swipe to open URL</p></figcaption></figure>
{% endcolumn %}

{% column %}
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](https://github.com/jigx-com/jigx-samples/blob/main/quickstart/jigx-samples/jigs/jigx-actions/open-url/open-url-swipeable.jigx).
{% endcolumn %}
{% endcolumns %}

```yaml
item:
  type: component.list-item
  options:
    title: =@ctx.current.item.lastname
    subtitle: =@ctx.current.item.firstname
    leftElement: 
      element: avatar
      text: " "
      uri: =@ctx.current.item.img
    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

{% columns %}
{% column %}

<figure><img src="/files/HGYFpuHFUmz2Z753lpyO" alt="Button to open URL" width="188"><figcaption><p>Button to open URL</p></figcaption></figure>
{% endcolumn %}

{% column %}
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](https://github.com/jigx-com/jigx-samples/blob/main/quickstart/jigx-samples/jigs/jigx-actions/open-url/open-url-right-element.jigx).
{% endcolumn %}
{% endcolumns %}

```yaml
item:
  type: component.list-item
  options:
    title: =@ctx.current.item.lastname
    subtitle: =@ctx.current.item.firstname
    leftElement: 
      element: avatar
      text: " "
      uri: =@ctx.current.item.img
    rightElement: 
      element: button
      title: Open
      onPress:
        type: action.open-url
        options:
          url: https://docs.jigx.com/examples/readme/actions/open-url
```

### open-url onSuccess

{% columns %}
{% column %}

<figure><img src="/files/cMjcktJa1ceoyboxFJNR" alt="Open URL onSuccess" width="188"><figcaption><p>Open URL onSuccess</p></figcaption></figure>
{% endcolumn %}

{% column %}
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](https://github.com/jigx-com/jigx-samples/blob/main/quickstart/jigx-samples/jigs/jigx-actions/open-url/open-url-on-success.jigx).
{% endcolumn %}
{% endcolumns %}

{% code title="open-url-on-success.jigx" %}

```yaml
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: =@ctx.components.signature.state.value
                onSuccess: 
                  title: Succesfully signed
                  actions:
                    - type: action.open-url
                      options:
                        title: Open the documentation
                        url: https://docs.jigx.com/examples
            - type: action.go-back
```

{% endcode %}

### Use open-url to deep link to an external app

{% columns %}
{% column %}
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.
{% endcolumn %}

{% column %}

<figure><img src="/files/IRaX3GRfU6KwYohRMZGk" alt="Open Google Maps"><figcaption><p>Open Google Maps</p></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

{% tabs %}
{% tab title="iOS-open-url" %}

```yaml
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.
```

{% endtab %}

{% tab title="Android-open-url" %}

```yaml
title: Zoos in the USA
type: jig.default

actions:
  - children:  
      - type: action.open-url #android
        options:
          title: Directions
          # Add the external app's Android deep link in the url
          url: google.navigation:q=2920+Zoo+Dr,San+Diego,CA+92101,United+States
      
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.
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.jigx.com/examples/readme/actions/open-url.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
