Has anyone got a simple step by step Mozilla plugin tutorial - npapi

I'm trying to create a Mozilla browser plugin for the sole purpose of detecting with javascript whether or not an application that I have written is installed. This was inspired by another stackoverflow question and answer on a similar subject.
All I want really is a HelloWorld type example as what I need to write will be even simpler than that. There is a lot of information on the Mozilla website, but as a plugin noob and a C++ novice I'm experiencing information overload. I just need a step by step "this is how to create your first simple plugin".
I have already written the IE equivalent by following this ATL tutorial. This is the kind of level of guide that I would ideally like to find.
Please note, this is specifically about Mozilla plugins and not extensions - Googling this subject brings up a lot of information about extensions in addition to plugins.

Here is a step by step guide for how to build the npruntime sample plugin using Visual Studio. When googling for info regarding Mozilla plugin development, search for npruntime. That is the scriptable plugin standard suported by Gecko (Firefox) as well as Opera and Chrome.

Related

Chromium Embedded Framework (CEF) html5 desktop application

I am new to Chromium Embedded Framework (CEF). How can I create an HTML5 desktop application using CEF. I serached a lot. But still confused about developing the applicaion.
please help.
You can create a CEF application in different languages (c/c++ or C#, python or ...), what is your preference about that?
In case of C# you might want to try https://github.com/cefsharp/CefSharp, I used this one in the past and it worked really great!
There are also sample projects in the CEF svn found here:
CefClient and CefSimple
Together with this tutorial here: https://bitbucket.org/chromiumembedded/cef/wiki/Tutorial
In the past I used CefSharp and one time I changed the CefClient example (removed everything I didn't need) and rebuild it. Using CefSharp was a lot simpler than the CefClient.
Another possibility might be https://github.com/rogerwang/node-webkit but that isn't CEF so a bit offtopic
edit:
For java there seem to be two CEF Wrappers
javachromiumembedded
javacef
See an example application here (code): javacef

Wrapping a HTML5 app into an executable for Windows/Linux/Mac

I'm building a HTML5 mobile app which I'm going to wrap in an Android and an iOS app with a simple web view. However, I have some users that use my current Adobe Air app (which is now unsupported), and I'd like to offer them this new app I'm building.
I've heared that Adobe Air's implementation of webkit is rather old and unstable.
Is there any good tools for wrapping a local browser (preferably webkit) and my app in an executable for cross-platform (PC) use?
I've just seen this http://appjs.org/ and I'm glad to see that Alex's TideSDK sounds great also !
Adobe AIR can do what you want, but I won't support that solution : it's slow and not really crossplatform since they drop the support on Linux if I'm correct.
If someone happen to test the others, feedback is welcome !
Off topic: Moreover I've chosen not to trust Adobe for my technical choices anymore. We've waited Flash on mobile for years, they drop the idea. We've been waiting for optimization on Mac and Linux for years, but nobody cares. The new hype some months ago was expecting compilation to HTML5, it's just some buzzwords mixed together and some old sketchy alpha version as far as I know.
EDIT
AppJS has moved http://appjs.com/
EDIT
node-webkit seems to be definitely a must see now ! https://github.com/rogerwang/node-webkit
Read an article lately about this sdk: http://www.tidesdk.org/ . I haven't worked with it yet - so can't really say if it's worth trying and doing what you want.

Will Dart scripts run natively in the browser?

The Dart language looks like a very nice technology to build web applications for the web. For me it seems that there are no browsers available (yet?) which can run Dart scripts natively. Although there's a description on Dart's site about how to embed such scripts into HTML. I understand that for now i have to "compile" Dart scripts to Javascript. But will this change in the future or the language is designed to be translated to other script standards similar to Haxe?
This is speculation, but I guess that Chrome will likely support dart natively in the future. It will mean that Chrome will be able to outperform other browsers that don't have the native support.
Update: There's a hint from The Official Google Code Blog that it might be coming:
The Dart VM is not currently integrated in Chrome but we plan to explore this option.
Update 2: It looks like I was right! Here's some recent news:
Additionally, and perhaps most importantly, Google is releasing Dartium, a Chromium build with native Dart support.
It’s more than likely that Dartium is part of a series of steps that Google will be taking to launch native support in Chrome — greatly improving the usefulness of Dart. Bringing native support into other browsers like Firefox and IE, on the other hand, will be quite the challenge.
Update 3: Since I posted this answer, Microsoft have released TypeScript which is a competing technology. I'd say it's unlikely that Microsoft have any intention of integrating Dart into Internet Explorer as they would probably prefer people to use TypeScript rather than Dart.
The official answer is Yes, Dart will run natively in Chrome. The branch of Chrome, affectionately called Dartium, is now available as source, and binaries will be released soon. More information on how to get and build the source: http://code.google.com/p/dart/wiki/BuildingDartium
As of March 25 of 2015, the offical answer is: no.
Source: Dart for the Entire Web
Google dropped the integration plan of the Dart VM into Chrome in favor of optimizing the Javascript compilation. Dartium is still accessible for development purposes.
Eventually, yes. The proposed MIME type + usage looks like this:
<script type="application/dart">
main() {
Element element = document.getElementById('message');
element.innerHTML = 'Hello from Dart';
}
</script>
(That example looks like JavaScript, but don't be fooled!)

Using Java/Python libraries in programming Firefox/Chrome Extensions

I have an idea of studying user behavior on the browser, for which I intend to make a Chrome/Firefox extension to study the behavior dynamically. I have some predefined libraries in Java and Python to analyze the results, which will be impossible to program in plain JavaScript.
Now for my question: is it possible to use third party libraries, especially those of Python or Java like plain function calls?
I have a vague idea about something like Java XPCOM or PyXPCOM for Firefox. However, for a beginner, it all looks so scary. I started making Add-On for Firefox, but got lost somewhere in the huge API.
I found Programming Chrome extensions easier than Firefox, but I couldn't come across something similar to XPCOM in Chrome.
How can I decide which one to go for?
Chrome - seems easy but I am not sure of its power.
Firefox - Seems powerful, but is it really possible to use any Java/Python Library?
Additionally, I came across this link that may be useful: How does someone use thirdparty libraries to be included in Firefox addons/extensions?
But seems like it mostly talks about C++ and XPCOM.
I have a vague idea about something like Java XPCOM or PyXPCOM for Firefox. But for a beginner, it all looks so scary.
I am not a beginner and JavaXPCOM/PyXPCOM are very scary (in addition to being barely maintained). As Firefox goes, it should be much easier to wrap your Java/Python library in an application and run it as an external process: https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIProcess. Note that you cannot get data back (other than an exit code) so the application should write it to a file that you can then read in your Firefox extension. Not very elegant but it has the advantage of being doable.
As to Chrome, its extensions run in a sandbox and using Java or Python isn't possible. Only option is adding an NPAPI plugin to your extension. It is binary code meaning that it could do anything.
When writing Chrome extensions, you're limited to JavaScript unless you choose to use an NPAPI plugin, which lets you do pretty much anything, but is not recommended.
The other approach you could take is to implement your Java or Python code on the server and make requests from the chrome extension's JavaScript.

Any example of writing an NPAPI plugin in Linux?

I need to write a browser plugin to communicate with another process, and it seems I have to use NPAPI plugins. Is there any example or open source NPAPI plugin I can refer to?
Many thanks for your reply.
Summary of answers
http://mxr.mozilla.org/seamonkey/source/modules/plugin/samples/
http://www.firebreath.org/
http://code.google.com/p/nixysa/
http://code.google.com/p/npapi-file-io/
2 and 3 are both frameworks to make plugin development easier.
I found one example at
http://mxr.mozilla.org/seamonkey/source/modules/plugin/samples/
you could also use the open source FireBreath plugin framework; they are nearing a 1.0 release for windows only, but it would not be hard to port it to linux; mac os shouldn't be bad either, but it will take a little work to get CMake to generate the correct bundle type =]
Yes, I am one of the primary maintainers, so I'm a bit biased. You can also find some good general information on how NPAPI works on my blog, starting here:
http://colonelpanic.net/2009/03/building-a-firefox-plugin-part-one/