Maksim Morozov
Maksim Morozov

Reputation: 191

PhoneGap link to Google Play

I use Cordova and PhoneGap to make my App I tryed to create a link to Google Play from App

<a href="market://details?id=com.restaurant.start">LINK</a>

But it is not work

Upvotes: 1

Views: 819

Answers (2)

Sumit Sahoo
Sumit Sahoo

Reputation: 3219

First you need to use Cordova/PhoneGap InAppBrowser plugin to redirect links to system instead of opening inside the App.

Install Plugin :

cordova plugin add org.apache.cordova.inappbrowser

After installing the plugin write a function to redirect the links to system. Code below.

function openExternal(elem) {
    window.open(elem.href, "_system");
    return false; // Prevent execution of the default onClick handler 
}

Then in your HTML file add the link as :

<a href="market://details?id=com.restaurant.start" onClick="javascript:return openExternal(this)">LINK</a>

Now the links should be redirected to system and you can choose browser or PlayStore to resolve the URL.

Upvotes: 2

Pavan Alapati
Pavan Alapati

Reputation: 101

Try this

<a onclick="redirect();"   id="addImage" style="background-color: #30739A;" ></a>
 function redirect()
{


        window.location = 'userlink';
}

Upvotes: -1

Related Questions