Receive URL in Ionic/Cordova

后端 未结 2 1050
悲哀的现实
悲哀的现实 2021-02-02 18:04

I\'m trying to set up a way to receive a url from another app. Like, you are in browser, click share, and send the link to another app (my app). I found this cordova plugin, and

2条回答
  •  后悔当初
    2021-02-02 19:01

    I've been working on something similar. I was able to get the url by using this plugin by Initsogar

    The plugin can be found here https://github.com/Initsogar/cordova-webintent

    You can get the incoming url as follows:

    var incomingURL
    window.plugins.webintent.getExtra(window.plugins.webintent.EXTRA_TEXT,
          function(url) {
            incomingURL = url
            console.log(incomingURL);
          }, function() {
            incomingURL = false;
          }
      );
    

    Hope this helps, and good luck on the app! Ionic is awesome :)

提交回复
热议问题