# Deep linking

### What is deep linking?

Deep linking does this by specifying a custom URL scheme (iOS Universal Links) or an intent URL (on Android devices) that opens your app if it’s already installed. Deep links can also be set to direct users to specific events or pages, which could tie into campaigns that you may want to run.

IoPay supports deep link below to open your pages in ioPay dapp browser :

```
iopay://io.iotex.iopay/open?action=web&url={{URL}}
```

### How to open your dapp in ioPay with deep link?

```
export const helper = {
  isPc() {
    const userAgentInfo = global?.navigator?.userAgent;
    const Agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'];
    let flag = true;
    for (let v = 0; v < Agents.length; v++) {
      if (userAgentInfo.indexOf(Agents[v]) > 0) {
        flag = false;
        break;
      }
    }
    return flag;
  },
  // check the dapp is in a mobile system browser
  checkEnv() {
    const isPc = this.isPc()
    const isBrower =  typeof window === 'undefined' ? false : true
    const isIopayMobile = window?.navigator?.userAgent && (window?.navigator?.userAgent.includes('IoPayAndroid') || window?.navigator?.userAgent.includes('IoPayiOs'))
    console.log('isBrower', isBrower, 'isIopayMobile' , isIopayMobile)
    if (!isPc) {
      if(isBrower && isIopayMobile) {
        return true
      } else if (isBrower && !isIopayMobile) {
        this.openDeepLink()
        return false
      }
    }
    return true;
  },
  //open the dapp with ioPay deep linking
  openDeepLink() {
    const a = document.createElement("a");
    const tagId = "startIoPay";
    a.setAttribute("href", `iopay://io.iotex.iopay/open?action=web&url=${window.location.href}`);
    a.setAttribute("id", tagId);
    if (document.getElementById(tagId)) {
      // @ts-ignore
      document.body.removeChild(document.getElementById(tagId));
    }
    document.body.appendChild(a);
    a.click();
    setTimeout(() => {
      window.location.href = 'https://iopay.me/'
    }, 4000)
  }
}
```


---

# 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.iopay.me/developer-guides/deep-linking.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.
