I would like to make a link in my phonegap app that should open on tap in an external app, that is separate from the phonegap app.
For eg I would like to provide users with a link to review my app and when they tap it the play store app should open and the phonegap app should remain open as background app.
I have tried different solutions including childbrowser plugin:
window.plugins.childBrowser.openExternal('link')
window.open('link')
+ different variations
but it opens the link in the current webview and the phonegap app gets replaced with the play store app.
So, how can I open an external link in a separate app?
For eg I would like to provide users with a link to review my app and when they tap it the play store app should open and the phonegap app should remain open as background app.
I have tried different solutions including childbrowser plugin:
window.plugins.childBrowser.openExternal('link')
window.open('link')
+ different variations
but it opens the link in the current webview and the phonegap app gets replaced with the play store app.
So, how can I open an external link in a separate app?
- 28 Posts
- 2 Reply Likes
- frustrated
Posted 7 years ago
- 1941 Posts
- 89 Reply Likes
Hey Daniel,
Here is some information you may find helpful.
Currently for 2.2.0 and below:
https://build.phonegap.com/blog/acces...
However once we add support for 2.3.0 (very soon) you will be able to use the following.
http://docs.phonegap.com/en/2.3.0/cor...
Hope that helps.
Hardeep Shoker
Here is some information you may find helpful.
Currently for 2.2.0 and below:
https://build.phonegap.com/blog/acces...
However once we add support for 2.3.0 (very soon) you will be able to use the following.
http://docs.phonegap.com/en/2.3.0/cor...
Hope that helps.
Hardeep Shoker
- 4 Posts
- 0 Reply Likes
Hi, here I found the solution:
https://github.com/stuartpb/stepdub/i...
To summarize:
1) window.open(encodeURI(theUrl), '_system');}
2) in config.xml:
preference name="phonegap-version" value="2.5.0"/>
preference name="stay-in-webview" value="false"/>
access origin="*" browserOnly="true"/>
3) in index.html:
script src="phonegap.js">
Hope this helps!
Andrew
https://github.com/stuartpb/stepdub/i...
To summarize:
1) window.open(encodeURI(theUrl), '_system');}
2) in config.xml:
preference name="phonegap-version" value="2.5.0"/>
preference name="stay-in-webview" value="false"/>
access origin="*" browserOnly="true"/>
3) in index.html:
script src="phonegap.js">
Hope this helps!
Andrew
- 15 Posts
- 0 Reply Likes
Hello Daniel,
I had a similar question:
http://community.phonegap.com/nitobi/...
What worked for me is specifying the access origin for the links which I want to show up in my app. Any links which are not specified by the access origin will AUTOMATICALLY open in a browser. I didn't need to add any plugins. I explained the solution at the end of the post. Hope I was clear.
The only thing is I'm not sure you can open the Play Store. You can specify the link to the online Play Store. As far as I know, you can't open the Play Store.
Denis
I had a similar question:
http://community.phonegap.com/nitobi/...
What worked for me is specifying the access origin for the links which I want to show up in my app. Any links which are not specified by the access origin will AUTOMATICALLY open in a browser. I didn't need to add any plugins. I explained the solution at the end of the post. Hope I was clear.
The only thing is I'm not sure you can open the Play Store. You can specify the link to the online Play Store. As far as I know, you can't open the Play Store.
Denis
- 12 Posts
- 2 Reply Likes
I have tried everything that I can think of and nothing works to get android devices to launch the external browser. Since version 2.1 this has not functioned on Android devices built with phonegap.build. How lame is it that I have been reading people complaining about this for over a year and the problem still exists in v2.5. Some people say to use the Cordova childbrowser plugin? I havent been able to get that to work either and even if it did, loading the entire js library just to have the ability to open the external/system browser. What is the deal here phonegap, is this just totally broken and never going to function with phonegap build?
Some of the things that I have tried:
window.open variants
var ref = window.open('http://apache.org', '_blank', 'location=yes');
var ref2 = window.open(encodeURI(url), '_system', 'location=yes');
jquery mobile link text
regular href's using target="_blank"
neither of these settings for the config.xml do anything:
preference name="stay-in-webview" value="false"/>
access origin="*" browserOnly="true"/>
Some of the things that I have tried:
window.open variants
var ref = window.open('http://apache.org', '_blank', 'location=yes');
var ref2 = window.open(encodeURI(url), '_system', 'location=yes');
jquery mobile link text
regular href's using target="_blank"
neither of these settings for the config.xml do anything:
preference name="stay-in-webview" value="false"/>
access origin="*" browserOnly="true"/>
- 2 Posts
- 0 Reply Likes
Here, my Email is epikit@gmail.com. I may be able to help, and you also may be able to help with a project of mine. I tried finding your contact info elsewhere, but to no avail.
- 4 Posts
- 0 Reply Likes
- 15 Posts
- 0 Reply Likes
Please look at my example...it explains exactly how to do it. Stay-in-webview doesn't work with Android, neither does browserOnly, neither does _blank. What worked for me is specifying access origin. If you say access origin = "*", that means ALL links will open inside your app. You need to specify only the links which should open in your app. All the links that aren't specified will bring up external browser option.
- 12 Posts
- 2 Reply Likes
Hi denikov, thanks for the reply.
In my app I have a link to "view full website" that I want to open in an external browser and not in the app. So...
1. I load the phonegap.js in my index.html file.
2. I setup a simple function that does this:
window.open(encodeURI('http://mywebsite.com'), '_system');
3. I have my config.xml setup with:
access origin="http://phonegap.com" /> also tried just access />
4. I call my function with an onclick for a button image.
From what you said above, since my access origin is pointing to a different domain, then any other link that points to a domain other than that in the access origin should open up in an external browser and not webview right?
Am I still missing something because I can't get this to work with phonegap.build, regular phonegap isnt an issue...
_thanks
In my app I have a link to "view full website" that I want to open in an external browser and not in the app. So...
1. I load the phonegap.js in my index.html file.
2. I setup a simple function that does this:
window.open(encodeURI('http://mywebsite.com'), '_system');
3. I have my config.xml setup with:
access origin="http://phonegap.com" /> also tried just access />
4. I call my function with an onclick for a button image.
From what you said above, since my access origin is pointing to a different domain, then any other link that points to a domain other than that in the access origin should open up in an external browser and not webview right?
Am I still missing something because I can't get this to work with phonegap.build, regular phonegap isnt an issue...
_thanks
- 15 Posts
- 0 Reply Likes
Hello Dan,
I guess I missed that part somewhere. I thought you were struggling with the regular phonegap in eclipse, I didn't notice it was about phonegap.build. I have only worked with regular phonegap so if this is a phonegap.build issue, I can't help you there. I'm not sure why it would be different...
The way I did it in regular phonegap is just have a normal href and specifying the access. If that href isn't specified, it prompts a open in browser option. Sorry I couldn't be more helpful...
Denis
I guess I missed that part somewhere. I thought you were struggling with the regular phonegap in eclipse, I didn't notice it was about phonegap.build. I have only worked with regular phonegap so if this is a phonegap.build issue, I can't help you there. I'm not sure why it would be different...
The way I did it in regular phonegap is just have a normal href and specifying the access. If that href isn't specified, it prompts a open in browser option. Sorry I couldn't be more helpful...
Denis
- 1 Post
- 0 Reply Likes
Hey, i work with window.open and "_system", too (phone gap 2.9.0 in Eclipse). My problem is that the function window.close() crashes my app then. It seems not be possible for external system browser. But how to close it? not possible?
Steven
Steven
- 2 Posts
- 0 Reply Likes
- 1 Post
- 0 Reply Likes
Same problem has occurred in cordova(phonegap) 3.4 with cordova-plugin-inappbrowser.
- 4116 Posts
- 192 Reply Likes
Hi Foobar,
I would recommend filing this issue at one of the links below as your issue seems to be related to PG(local build):
PhoneGap Google Group: https://groups.google.com/forum/?fromgroups#!forum/phonegap
Cordova @ Stackoverflow: http://stackoverflow.com/questions/tagged/cordova
IRC Channel: Server: irc.freenode.net | Channel: #phonegap
Dedicated PhoneGap Paid Support: http://phonegap.com/support/
Developers Directory: http://people.phonegap.com/
The engineers there would be better able to assist you.
Thanks.
I would recommend filing this issue at one of the links below as your issue seems to be related to PG(local build):
PhoneGap Google Group: https://groups.google.com/forum/?fromgroups#!forum/phonegap
Cordova @ Stackoverflow: http://stackoverflow.com/questions/tagged/cordova
IRC Channel: Server: irc.freenode.net | Channel: #phonegap
Dedicated PhoneGap Paid Support: http://phonegap.com/support/
Developers Directory: http://people.phonegap.com/
The engineers there would be better able to assist you.
Thanks.
- 3 Posts
- 0 Reply Likes
Here is the full tutorials on Phonegap just try out once hope it will help you.
Here is the Link -- > http://www.brotsky.tv/2013/12/07/phon...
Thank you
Here is the Link -- > http://www.brotsky.tv/2013/12/07/phon...
Thank you
- 1 Post
- 0 Reply Likes
hi friends i have seen a good tutorial and example here......
http://androidexample.com/Show_Loader...
http://androidexample.com/Show_Loader...
Related Categories
-
PhoneGap Build
- 15111 Conversations
- 275 Followers





