【问题标题】:Metamask onboarding/install redirect chrome extension/mobileMetamask 入职/安装重定向 chrome 扩展/移动
【发布时间】:2022-06-11 09:13:01
【问题描述】:

在用户安装移动应用/chrome 扩展后,有没有办法强制/告诉 metamask 重定向到特定页面。

我已经使用元掩码深度链接/入职库,但根本没有重定向。 目前的流程如下 在桌面上:

1/ 客户到达询问 eth 帐户的页面,入职库检测是否安装了元掩码

2/ 如果没有安装 metamask,onboarding lib 会将用户重定向到另一个选项卡中的 chrome 商店扩展

3/ 注册过程完成后,用户“卡”在这个 chrome 扩展页面,他需要自己去标签页询问他的地址

在手机上

1/ 客户到达询问 eth 帐户的页面,入职库检测是否安装了元掩码

2/ 如果没有安装元掩码,我将用户重定向到元掩码深层链接,从而将他重定向到 android 商店

3/ 注册完成后,用户“卡”在应用程序上,他需要自己去标签页询问他的地址

有没有办法在第 3 步为这两个过程添加重定向?

【问题讨论】:

    标签: metamask


    【解决方案1】:
    const dappUrl = "adljflajf.com"; // TODO enter your dapp URL. 
    // For example: https://uniswap.exchange. (don't enter the "https://")
    let metamaskAppDeepLink = "https://metamask.app.link/dapp/" + dappUrl;
    
    window.open(metamaskAppDeepLink)
    

    ////你需要通过用户交互来做到这一点,否则你会得到弹出块////

    像这样使用sweetalert

    import Swal from 'sweetalert2';
    
    Swal.fire({
        title: 'changing to mobile',
        text: "you are open this dapp from a mobile device",
        icon: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#3085d6',
        cancelButtonColor: '#d33',
        confirmButtonText: 'open in metamask'
        }).then((result) => {
           if (result.isConfirmed) {
              Swal.fire(
                'now click on metamask!',
                'continue on metamask.',
                'success'
              ).then( window.open(metamaskAppDeepLink));
           }else{(window.location.reload())}
        })
    

    其他步骤也一样

    【讨论】:

      猜你喜欢
      • 2021-11-15
      • 1970-01-01
      • 2018-01-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多