With the browser platform target support in PhoneGap, you also have the ability to write code handling for it specifically when developing your own custom plugins. Some plugins will be easier to support it than others depending on what native feature they're exposing by allowing you to specify mock data or simply returning a console message. It's up to the plugin author to determine what's most desired in that case.
To support the browser in your own plugins, follow the Cordova Plugin Development docs on the Official Apache Cordova site and ensure you've defined the
browser platform handling in your
browser platform handling code in the
src/browser path in your plugin root. For instance:
You'll need to ensure you name these browser platform-specific JS files with different names then the client-side implementation included in the
www by default. Most of the Apache Cordova plugins add the word
Proxy to the class. You can take a look at any of the Apache Cordova core plugins for specific examples.
For instance, by taking a look at the Apache Cordova Camera plugin.xml, you will see how the
CameraProxy.js class is defined with the following:
<!-- browser --> <platform name="browser"> <config-file target="config.xml" parent="/*"> <feature name="Camera"> <param name="browser-package" value="Camera" /> </feature> </config-file> <js-module src="src/browser/CameraProxy.js" name="CameraProxy"> <runs /> </js-module> </platform>