-
1. Re: Phonegap builded Android app didnt open external links
VectorP Aug 20, 2016 10:22 PM (in response to JokerzFree)I wonder if the 'tap' event is ever fired. Did you check whether or not that open() call was ever reached?
Also, I noticed a comma at the end of that code line 04, which could trigger a parse error.
-
2. Re: Phonegap builded Android app didnt open external links
JokerzFree Aug 21, 2016 2:27 AM (in response to VectorP)VectorP написал(а):
I wonder if the 'tap' event is ever fired. Did you check whether or not that open() call was ever reached?
Also, I noticed a comma at the end of that code line 04, which could trigger a parse error.
Edit JS part to check work tap event on device or not:
$(document).on('tap', 'a[href^="http://"], a[href^="https://"]', function(e){ e.preventDefault(); $this = $(this); $('#header h1').html('open!!'); if(typeof cordova != 'undefined'){ $('#header h1').html('cordova work!!'); cordova.InAppBrowser.open($this.attr('href'), '_system'); } else { window.open($this.attr('href'), '_system'); } });
Header change to 'open!!' but link not opened, so tap event work normally. (typeof cordova added for browser compability).
Also into my device cordova is undefined because of header not changed, so where is a problem? maybe i not included something important into index.html or config.xml? -
3. Re: Phonegap builded Android app didnt open external links
VectorP Aug 21, 2016 6:24 AM (in response to JokerzFree)If 'cordova' is undefined:
- your config.xml wasn't read and/or parsed, OR
- you don't have cordova.js referenced in your html, OR
- you didn't wait for the 'deviceready' event to fire.
In your original question, you supplied a link for the index.html. What I see there is a regular web document, which is not prepared for use at PGB. Is that your index.html?
-
4. Re: Phonegap builded Android app didnt open external links
arviio Aug 21, 2016 11:46 PM (in response to JokerzFree)Hello,
You might need to add this plugin cordova-plugin-whitelist
<plugin name="cordova-plugin-whitelist" spec="~1.2.1" source="npm"/>
then read the cordova-plugin-whitelist for navigation whitelist.
-
5. Re: Phonegap builded Android app didnt open external links
VectorP Aug 22, 2016 12:47 AM (in response to arviio)But why?
The OP is using the inappbrowser plugin with the _system parameter at the open() call.
AFAIK, the whitelisting has no relevance in such case.
-
6. Re: Phonegap builded Android app didnt open external links
JokerzFree Aug 22, 2016 1:18 PM (in response to VectorP)This is realy help. After i add this all links opened just by default window.open function (but cordova plugin i didnt delete, just in case).
Thanks Arviio!Also Thanks for your reply and help - VectorP!
-
7. Re: Phonegap builded Android app didnt open external links
arviio Aug 22, 2016 8:59 PM (in response to JokerzFree)Glad it worked. Cheers!