如果用户想在Android手机中打开网站,请打开谷歌Play商店链接的应用程序[关闭]

I have a website and an Android application as well. I want my user to be redirected to the Play Store link for my app if they open the website in the Android phone browser. What is the best approach to achieve this?

You don't need to do anything special. When you click on a link to the Play Store from any browser on an Android phone, the Market app will handle the link automatically.

For example, try clicking this link on your Android device:

http://play.google.com/store/apps/details?id=com.google.android.apps.maps

If the Market app is installed, it will automatically open the page to install the application.

There are lots of resources for detecting an Android user-agent and redirecting. For example http://davidwalsh.name/detect-android

var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
if(isAndroid) {
    // Do something!
    // Redirect to Android-site?
    window.location = 'http://play.google.com/store/apps/details?id=com.google.android.apps.maps';
}