微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

深度链接在测试中工作,但不在生产中工作,Android Cordova Webview

如何解决深度链接在测试中工作,但不在生产中工作,Android Cordova Webview

我已经使用CORS在cordova Webview应用程序中实现了深层链接。与我的网站地址的任何链接都可以打开我的应用程序。在测试Deeplink时,将在我的应用程序中打开确切的URL,但在生产中,没有打开确切的URL。它只是打开应用程序的主页。

寻求任何帮助。下面的代码

config.xml

<universal-links>
 <host name="www.stalksnspice.com" scheme="https">
   <path url="*" event="openSignInPage" />
 </host>
</universal-links>

index.js

 onDeviceReady: function() {
    app.receivedEvent('deviceready');


    // Here,we redirect to the web site.
    var targetUrl = "https://www.stalksnspice.com/";
    var bkpLink = document.getElementById("bkpLink");
    bkpLink.setAttribute("href",targetUrl);
    window.location.replace(targetUrl);

    //Deep linking/Universal Url Code
    universalLinks.subscribe('openSignInPage',app.onopenSignInPage);


},onopenSignInPage: function(eventData) {
  console.log('Did launch app from the link: ' + eventData.url);
  var targetUrl = eventData.url;
  var bkpLink = document.getElementById("bkpLink");
  bkpLink.setAttribute("href",targetUrl);
  window.location.replace(targetUrl);
},

index.html

<body>
  <a id="bkpLink" href="https://www.stalksnspice.com"></a>
    <div class="app">
        <div id="deviceready" class="blink">
            <p class="event listening"></p>
            <p class="event received"></p>
        </div>
    </div>
    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
</body>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。