Android refuses to launch Google Play links from JavaScript in web applications

My HTML app is wrapped in Phonegap and available on the Android store.

I want to include a link within the app for users to update it if a new version is available.

From what I've gathered from documentation and some Stack Overflow posts, the following code should open the store:

Update App

However, I need to trigger this link using JavaScript. I've attempted both window.open and window.location.href but they only open the browser and display a URL not found error with a URL starting with http://market://details...

Does anyone know why this happens or how I can directly link to the store instead of the Play website?

---------------UPDATE -------------------

I'm specifically looking to open the native Play Store, not just any browser-based version. It's been done before as smartbanner manages to do so successfully. More information can be found here:

Despite knowing that it's possible, I haven't been able to replicate this functionality. Any insights would be greatly appreciated.

Answer №1

It turns out that phonegap has a unique way of handling window.open, by checking the protocol used. When using '_blank' in phonegap, it doesn't actually open a new browser window, but rather opens a browser window owned by phonegap itself, restricted to only http or https protocols (presumably).

If you want to open a link in the system browser, you need to use

window.open("market://details?=com.your.app","_system");

This will direct the request outside of phonegap and open the link in the native browser, which will correctly redirect to the native app store.

Answer №2

Person target="_top"

 <a href="market://details?id={package_name}" target="_top">Application</a>

Answer №3

According to information provided by Google here

To direct users to a specific app's product details page, follow the format below. This page will showcase the app description, screenshots, reviews, and more, allowing users to easily install it.

In order to generate the link, you must have knowledge of the app's fully qualified package name as stated in the app's manifest file. The package name can also be found in the Developer Console.

For a website: (these links will prompt a dialog for choosing between browser or market)

http://play.google.com/store/apps/details?id=<package_name>

For an Android app:

market://details?id=<package_name>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Execution of Promises in sequence

In my current implementation, I have multiple promise functions structured like: return new Promise(function(resolve, reject) { //logic }); cart.getBasket(req) cart.updateBasket(req) cart.updateDefaultShipment(req) cart.getBasketObject(basket) The cod ...

I'm looking for guidance on how to merge my JavaScript and CSS files together. Can anyone provide me

As a beginner in web development, I have been looking into combining JS and CSS files. However, explanations using terms like minifies and compilers on platforms like Github and Google are still confusing to me. Here are the CSS files I have: bootstrap ...

Vue Router displays a blank page after being compiled

Seeking assistance here. I have built my application using vuejs and everything seems to be working fine. However, when I run npm run build, extract the dist folder, and open index.html, all I see is a blank page with no errors in the console. main.js impo ...

What is the reason for the unique coding of the album art's URI?

What is the reasoning behind appending an album art Uri in the following way: final Uri sArtworkUri = Uri.parse("content://media/external/audio/albumart"); Uri uri = ContentUris.withAppendedId(sArtworkUri, album_id); Why shouldn't it be done like t ...

Utilizing html2canvas in pdf-lib using JavaScript

Hey there, I have a few questions concerning the usage of html2canvas. Currently, I am delving into JavaScript and working on a platform aimed at generating budgets that can be downloaded in PDF format. My goal is to utilize html2canvas to capture a dynami ...

Unlock the full potential of RoboSpice with these cache strategies

Just a question from someone new to caching mechanisms on Android. Why does RS opt for LRU caching in the FlickrSpiceService sample? You have the LruCacheBitmapObjectPersister: @Override public CacheManager createCacheManager(Application application) th ...

Internal styles are effective, while external styles seem to be less efficient

For some reason, internal CSS is working fine, but external CSS just won't cooperate. I even tried using the code !important, but it's like it doesn't understand. I'm trying to incorporate a gallery into my website, but I've hit a ...

The AOSP dialer application experienced a crash on the Nexus 6P device

While building AOSP for the Nexus 6P device, known as angler, everything seems to be working fine except for the dialer app. I am currently on the "8.0.0_r17" tag and encountering an issue with the dialer app. Has anyone else experienced this problem or ...

Troubleshooting iFrame Loading Issues with HTML5 PostMessage

Our code is utilizing the newest postMessage feature in HTML 5 to address cross-domain communication challenges. The issue I am facing is figuring out how to determine if the messages posted to an iFrame have been successfully loaded. If the frame fails to ...

ImageSpan creates additional spacing between lines of text

When attempting to add an ImageSpan in front of a textview, I am noticing extra spacing between the lines on a tablet like Nexus 7. https://i.sstatic.net/XqKpt.png However, on Nexus5x, everything appears fine. https://i.sstatic.net/kDC5q.png public vo ...

Comparing an EditText and a Chronometer: What to Consider?

As a relative beginner in Android development, I have been struggling to understand how to use the chronometer. After spending the entire day studying it, I have figured out how to reset the clock using ElapsedRealTime. However, I am still unsure of how to ...

Merge text inputs to preview content prior to form submission

I've been on the hunt for a solution to display the collective values entered into multiple text box fields as they are being typed. Currently, I have 6 text boxes (description1, description2, description3, description4, description5, description6) wh ...

The operation '&' is not supported for the data types 'String' and 'System.Collection.Hashtable'

When attempting to send a hashtable to my user-defined function ajaxSCall(), which requires a hashtable in the last argument at '" & mData & "', an error is displayed stating "Operator '&' is not defined for types 'String' an ...

Seeking recommendations for designing a database architecture

My friend and I collaborated on building a MySQL php website that allows users to make predictions on sports events. The issue at hand concerns our "rankings" page, which showcases the top members based on their predictions. Initially, each time a user vi ...

The error in React syntax doesn't appear to be visible in CodePen

Currently, I am diving into the React Tutorial for creating a tic-tac-toe game. If you'd like to take a look at my code on Codepen, feel free to click here. Upon reviewing my code, I noticed a bug at line 21 where there is a missing comma after ' ...

Is the scope causing the inability to update the variable with the final score on the quiz page?

I'm currently developing a quiz page layout. My issue lies with a variable that stores the total score, as I can't seem to display it when the player answers the final question of the quiz. Interestingly, when I log the variable in the console, t ...

challenging multiple substitution within a sentence

My string is as follows: var query = "@id >= 4 OR @id2 < 6 AND @id3 >= 5 AND @name = foo " I want to reverse every "equality" test in this string. This means replacing ' >=' with ' <', ' <' with ' > ...

Leveraging the power of Discord.js to verify the image URL within an embed

The concept My goal is to create a bot that can detect embedded images in messages and send a predetermined response if the image URL matches a specific URL provided. I am looking for a way to trigger this check whenever a message is sent with an embed. ...

What causes the first button to be clicked and the form to be submitted when the enter key is pressed within a text

Start by opening the javascript console, then place your cursor in the text box and hit enter. What is the reason for the function "baz" being called? How can this behavior be prevented? function foo() { console.log('foo'); } function bar() ...

Alternative for document.ready in AngularJS when outside of AngularJS

I am currently developing a small Chrome extension that will interact with an Angular website. I have managed to successfully detect full page reloads using $(document).ready(), but I am facing issues when it comes to detecting page changes triggered by ng ...