Deep link inside Metamask mobile browser

Hi can anyone help me, I have a problem regarding MetaMask mobile browser, I have a redirect button to open an app in my android phone, I was using <a href="unitydl://mylink">Launch</a> for my button, it was working in chrome but inside MetaMask mobile browser it doesn’t, does the MetaMask mobile browser supports deep link ?

1 Like

@ganielleDOTexe

Hello !
Welcome to the MetaMask community!
Give me some time to check your problem :wink:

2 Likes

Of course support)

You should declare a device check function if you don’t have one in your code:

function isMobileDevice() {
  return "ontouchstart" in window || "onmsgesturechange" in window;
}

And based on the result of its execution, declare the following redirection logic:

  <Button
        onClick={() => {
                      if (isMobileDevice()) {
                      window.open(metamaskAppDeepLink);
                       } else {
                        window.open("https://metamask.io/", "_blank");
                      }
                    }}
                  >
                    Launch
 </Button>

Please let me know what results these actions bring to you :wink:

6 Likes

Sorry for the terrible
tabulation of the code, at the moment there is only access to a smartphone :rofl:

2 Likes

Thank you for this !! It worked !! I’m having this problem since 8am today! you save me a day of craziness :sob: :sob: :sob: ! Thank you again you’re the best !

3 Likes

@ganielleDOTexe

Wonderful! I’m glad I saved your time and nerves :rofl:
If you want, you can close the topic with the mark solved :wink:

3 Likes