Detect if Cordova plugin exists

cordova, phonegap-plugins

Solution

you can do a setTimeout for 100 ms before trying to access the plugin, and on success/failure of the plugin cancel the timeout. if the timeout triggers - the plugin is not installed.

Problem

Is there a way to tell if a specific Cordova plugin is available to be called in Cordova 2.5.0? `Cordova.exec` takes in a `successFunction` and a `failFunction` but the `failFunction` is only called if the native code executes. Is there a way to receive an error or callback if the receiving function doesn't exist? I'm looking for a solution that works with a remove URL loaded into WebView http://docs.phonegap.com/en/2.5.0/guide_plugin-development_ios_index.md.html

Original source