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?
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.
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.
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.
Related
I am curious and need to know which platform or IDE to make a desktop application like opera browser https://www.opera.com
there are many IDE which provide webviewer class.
For example, QT is a kind of powerful library.
If you start qtSDK, you can check webbrowser on the example tag.
Or you may use ElectronJS(javascript library for cross-platform app development).
https://electronjs.org
There are many libraries and frameworks of JavaScript and you may either use Express JS, React Js , Flutter for the development of browser.
What JS 'engine' does Cordova use? Is it platform specific or is it one standard across all platforms? Meaning safari for iOS and chrome for Android, and possible IE standards for windows? Or a 'Cordova JS' engine across all platforms.
More specifically i read that it depends on the browser JS implementation for what sorting algorithm .sort() uses (Mozilla uses merge-sort). And i was considering using a merge-sort function i created or the standard .sort() function. (which could be a merge-sort anyway). The built in .sort() seems to be about 10ms quicker, or about 14% quicker.
Only reason I would want to use my merge-sort (slower) is because I know for sure it will be implemented exactly the same across iOS, windows, android, etc...
On Android it uses Android WebView which is based on Chromium, and uses the V8 JavaScript engine.
On iOS, as of iOS8 it uses the WKWebView which is based on Safari and uses the Nitro JavaScript engine.
On other platforms... well, whatever the native web view is.
Cordova is, at the end of the day, a native app with a web view embedded inside, and it uses the web browser component specific to the platform where the app is deployed.
If you wish to use another Web browser component is still possible. Take a look at Crosswalk.
Since the WebView implementation on Android depends on the Android version and the manufacturer (Samsung and other manufacturers apply their own patches to it), I'd like to provide my own rendering engine for my Android app to reduce QA overhead and gain more confidence.
I tinkered around with both the Chrome engine (Chromium) and the Firefox engine (GeckoView) and integrated them into my Android app.
The GeckoView is very straight forward to integrate and so far it is working well. The only thing I am missing is a Javascript interface (bi-directional) similar to WebView's addJavascriptInterface.
Is there any way to get Javascript callbacks and to execute Javascript with GeckoView?
I have written a windowless NPAPI plugin which binds to a shared library for accessing my native resources. The plugin is loaded by a web Application running in Firefox browser.
Recently, I have seen in net, that using Java Script extensions, one can also make native code function calls.But these Java Script extensions are specific to browsers.
Can some one please tell me that if I use a Java Script extension instead of NPAPI plugin for calling my native code, will there be any performance improvement in terms of latency in making native library API calls?
Kindly note: My query is generic and not specifically for Firefox browser.
There is no generic answer to a question like this, the mechanisms implemented by different browsers have nothing in common.
Firefox: A native library can be called via js-ctypes. This mechanism should be more light-weight than the communication with an NPAPI plugin. Even more importantly, you don't have the overhead of inter-process communication (newer Firefox versions run plugins in separate processes).
Chrome: AFAIK the only way to access operating system functionality (such as writing files to a random location on disk) is via NPAPI, Chrome won't allow extensions to use system libraries. However, if you use a native library only to speed up execution and don't mind having this code run in a sandbox - the native client might work for you. Due to sandboxed execution it will probably be slower than an NPAPI plugin but it won't trigger huge scary warnings when your extension is installed.
Safari: From what I know, Safari doesn't let you use native libraries, not even via NPAPI plugins.
Internet Explorer: As of MSIE 9.0, Internet Explorer still doesn't have anything resembling JavaScript-based extensions.
I have a strange behavior on the iPhone browser. Is there a tool to debug the JavaScript of the iPhone browser?
I'm hoping there's something more advanced than simple alert() messages. Is there something with advanced tools like setting breakpoints and viewing object states?
With the release of iOS 6, Apple released Remote Web Inspector for their Mobile Safari, and this is huge. Basically you have all the features and power of Web Inspector in regular Safari, for your mobile apps, including Phonegap apps.
I've used weinre but this tool makes it obsolete for newer versions of iOS (unfortunately not for old versions of iOS, non-iOS devices, or if you're on Windows) since its a full-featured debugger with breakpoints and everything.
Requirements:
A Mac with Safari 6+
Either a USB-attached iOS 6+ device or xCode 4.5+ running an iOS 6+ simulator
How to activate the inspector:
In your simulator or device, open Settings > Safari > Advanced > Web Inspector > On
(this is on by default in the simulator)
In Safari 6+ for Mac, access your page from the Develop menu. You can enable Develop menu in Safari's Advanced Preferences if its not showing up.
More discussion at the bottom of:
http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers
(Also, if you read about a "secret private interface" or iWebInspector somewhere, these are also made obsolete.)
check out weinre or use the remote version debug phonegap.
cu
you can also inject firebug using a simple bookmark. I've used it on the ipad and my debugging abilities were immensely enhanced.
I faced a simple use case in which I only needed to test my code on a Safari's JS engine (Merely debugging, simply running it and consuming traces).
To that end I used Epiphany web browser, which is both free and uses JavaScriptCore JS engine which is also used by Safari.
Epiphany isn't provided with developer tools, so I used http://jsconsole.com/ to view my traces.
Though it is a thin solution, it helped me find a line which worked on Chrome but didn't on Safari.
Step by Step Guide How To Enable JavaScript in iPhone
Open your iPhone settings.
Tap on safari in the app list.
Tap on Advanced option.
Enable Javascript iPhone with the help of switch push.