Of course, you can use most of the same code base. Some call APIs are the same in html5 (e.g. localStorage), so there are no differences in code.
If you use the phonegap build service, it will add the phonegap.js / cordova.js script file to your project root. Just include it in your html all the time. Then you can determine if your application is running in a telephone congestion:
var isPhonegap = function() {
return (typeof(cordova) !== 'undefined' || typeof(phonegap) !== 'undefined');
}
if (isPhonegap()) {
} else {
}
If you need a regular startup code, put it in a function and call this function from the onDeviceReady handler and the else block above.
If the phone delay you are calling api does not have an exact name, like html5 (for example, for the Moz * or WebKit * prefix), just wrap both inside the new name. For instance:
var requestFileSystem = (isPhonegap() ? requestFileSystem : window.WebKitRequestFileSystem);
If the API used by your phone does not have the equivalent of html5, try to duplicate the functionality yourself in javascript, if possible, otherwise you will simply lose functionality in your browser. But make sure it is graceful enough without this feature.
. , , .., Ripple Chrome.