I've got an html app which is wrapped in Phonegap and in the android store.
I'd like to put a link to the app within the app for users to update if an update is available.
According to the documentation, and some results here on SO, on devices,
< a href="market://details?id=com.myapp.name" > Update App </a>
opens the store, but I need to open the link from javascript.
I've tried both window.open
and window.location.href
but both of those open the browser and I get a URL not found error. The url in the browser turns out to be http://market://details...
Anybody know why or how I can link directly to the store, not to the play website?
---------------UPDATE -------------------
I don't want to open the play store in a browser, I am trying to open the native play store.
I know this is possible because smartbanner opens the proper store. http://jasny.github.io/jquery.smartbanner/
But I can't get it to work.
Turns out that phonegap basically steals the window.open, and was checking the protocol used within. Therefore using '_blank'
within phonegap doesn't open a new browser window (as you'd expect) but instead opens a browser window within phonegap, which phonegap owns and only lets use either http or https protocols (I'm assuming those are the only two).
In order to pass a link to the system browser, you have to use
window.open("market://details?=com.your.app","_system");
and that will send the request out of phonegap and open the link in the native browser, which then redirects correctly to the native app store.
User target="_top"
<a href="market://details?id={package_name}" target="_top">App</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With