views:

799

answers:

4

Does the Android WebKit supports the XPCOM framework or NPRuntime API`s as like Firefox? How to implement JavaScript in the Android WebKit plug-in?

Update: I am writing a media player plug-in for the Android WebKit browser and my plug-in needs to get the command from the web page through JavaScript (some actions like play/pause/stop/resize are issued as JavaScript commands from the browser). My plug-in is written in native C code. Are there any examples or sample plug-in available for JavaScript communication?

+2  A: 

WebKit doesn't support XPCOM, as WebKit is entirely separate from the Mozilla stack.

When you say you want to "implement Javascript", what do you mean?
The built-in Android browser already supports the execution of Javascript.

Christopher
A: 

Android's WebKit doesn't support XPCOM, nor does it support NPAPI and npruntime. Not sure how you're planning to write a browser plugin, but it's not going to be possible with the Android SDK.

Roman Nurik
Does it mean ,JavaScript communication between the plug-in and browser is not possible ? or Is there any other way to do this Js communication?.My plugin is in native C code.
Krish
Plug-ins in general aren't supported in the Android SDK. How are you writing a browser plugin?
Roman Nurik
developing based on the available Sample plug-in (mydroid/development)/samples/BrowserPlugin)
Krish
Well don't I feel silly :-) Regardless, judging by the API docs: http://d.android.com/reference/android/webkit/PluginStub.html, it seems like you get an NPAPI plugin instance. You can look into using `npruntime` for exposing a JS interface to the plugin, but I'm completely unsure about whether or not this is possible
Roman Nurik
thanks Nurik,Is there any sample available for jS plugin
Krish
A: 

The android browser supported NPAPI all the time, the mechanism changed in 2.1 though, now it looks for APKs with the intent filter "android.webkit.PLUGIN", so a plugin needs to be packaged separately.

Previously setting the plugin path on the WebView and compiling the plugin using the NDK did the trick.

Hope this helps, you will find a lot of info when googling for NPAPI and WebView or NPAPI and android.

anselm
For those that didn't notice, there is a sample plugin in the Android (eclair) source already in development/samples/BrowserPlugin
anselm
A: 

I have read many posts on the Web about NPAPI android webkit support. I could not found a clear answer...

Some say that web plugins are not supported now you say that it is supported.

Can I create a plugin without modifying android sources? Are the 2.1 and 2.2 distributions compiled with the define ANDROID_PLUGINS?

Can I use PluginStub or another class since android.webkit.Plugin and other related classes have been deprecated?

Does any sample illustrating a plugin exist?

Patrice Dalle