1

I have implemented deeplinking in a cordova webview application using cordova-plugin-universal-links. Any link with my website address does open up my app. While testing the deeplink opens up the exact URL in my app, but in production the exact URL isn't opened. It just opens the home page of the app.

Looking for any assistance. Code below!

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>

0 Answers0