I\'m developing a web application that uses PhoneGap:Build for a mobile version and want to have a single codebase for the \'desktop\' and mobile versions. I want to be able
Another way, based on SlavikMe's solution:
Just use a query parameter passed to index.html from your PhoneGap source. Ie, in Android, instead of
super.loadUrl("file:///android_asset/www/index.html");
use
super.loadUrl("file:///android_asset/www/index.html?phonegap=1");
SlavikMe has a great list on where to do this on other platforms.
Then your index.html can simply do this:
if (window.location.href.match(/phonegap=1/)) {
alert("phonegap");
}
else {
alert("not phonegap");
}