Redirect to Play store
<p>I want to redirect user to my Play Store application page, when they type some url in their mobile browser. I tried following code, but it redirect to play store website instead of Play Store app in android phone.</p>

<pre><code>&lt;script type="text/javascript"&gt;
var userAgent = navigator.userAgent || navigator.vendor || window.opera;

if (/android/i.test(userAgent)) {
    window.location = "http://play.google.com/store/apps/details?id=com.example";
}
&lt;/script&gt;
</code></pre>

<p>After some searching on google I found that I have to use market url. Than I changed code as follow. But still no luck. This code is not redirecting anywhere.</p>

<pre><code>&lt;script type="text/javascript"&gt;
var userAgent = navigator.userAgent || navigator.vendor || window.opera;

if (/android/i.test(userAgent)) {
    window.location = "market://details?id=com.example";
}
&lt;/script&gt;
</code></pre>

<p>Can anyone help me to identify what I missed in this?</p>