Reputation: 928
I used this plugin for customURL scheme in my ionic project
https://github.com/EddyVerbruggen/Custom-URL-scheme
and my javascript code is
var handleOpenURL = function(url) {
alert("RECEIVED URL: " + url);
console.info(url);
console.info(typeof(url));
var a = url.replace(/[A-Za-z$-.:/]/g, "");
console.info(a);
};
I used myapptest
as an url while installing the plugin
but when i opened myapptest:\\
in browser it is opening a web page instead of navigating to the app.
Please suggest how to navigate to the app
Upvotes: 1
Views: 1289
Reputation: 65
I solved it by:
var handleOpenURL = function(url) {
alert("RECEIVED URL: " + url);
var res = url.slice(12);
console.log(res);
window.location.href = "#/app/"+res;
};
Then tested it by calling handleOpenURL("myapptest:\search") inside the browser console. It worked
Upvotes: 2