EddyVerbruggen / Custom-URL-scheme

:link: Launch your Cordova/PhoneGap app by a Custom URL scheme like mycoolapp://
1.03k stars 367 forks source link

handleOpenUrl is called everytime index.html is loaded #247

Open slorber opened 7 years ago

slorber commented 7 years ago

Hi,

I sometimes reload the index.html page in my app:

        var initialHref = window.location.href;
        function restartApplication() {
            navigator.splashscreen.show();
            window.location = initialHref;
        }

The problem is that on every restart, I get the handleOpenUrl callback fired. Is there a way to only get this callback fired once, and avoid firing it again and again on page reload?

slorber commented 7 years ago

Note that it also seems that the first and second time, the url is not fired with the same encoding:

By clicking on this link:

stample://magicLink?authToken=7e099121484003edd9e741736ac7e5dc47204f27-userId%3Dxxx

I get those 2 different strings logged into my app. The first one is wrong for me because the userId part should not be decoded and is part of the authToken querystring param

1) window.handleOpenURL stample://magicLink?authToken=7e099121484003edd9e741736ac7e5dc47204f27-userId=xxx

2) window.handleOpenURL stample://magicLink?authToken=7e099121484003edd9e741736ac7e5dc47204f27-userId%3Dxxx

cadesalaberry commented 7 years ago

I think https://github.com/EddyVerbruggen/Custom-URL-scheme/pull/245 should help you with your second question.

slorber commented 7 years ago

thanks @cadesalaberry

bala307 commented 7 years ago

what about the solution for first question?

bala307 commented 7 years ago

For me also handleOpenUrl callback is fired every time i reload the index page.Is there any solution to avoid firing it again and again on index page load?

andresullua commented 6 years ago

Is there anything new about the first issue?

vukhacbiet commented 4 years ago

Is there any solution for first issue