1. definition
a third party library that “plugs in” to the browser that can be embedded inside a web page using an <embed> tag or a <object> tag.Like:
Macromedia Flash
Apple quicktime
Landing encryption
How about firebug ? it’s a extension,not a plugin.
Above reference:
http://colonelpanic.net/2010/08/browser-plugins-vs-extensions-the-difference/2.what you can do with a plugin?
register one or more MIME types
draw into a part of a browser window
receive keyboard and mouse events
obtain data from the network using URLs
post data to URLs
add hyperlinks or hotspots that link to new URLs
draw into sections on an HTML page
communicate with JavaScript/DOM from native code
Above reference:
https://developer.mozilla.org/en-US/docs/Gecko_Plugin_API_Reference/Plug-in_Basics?redirectlocale=en-US&redirectslug=Gecko_Plugin_API_Reference%3APlug-in_Basics
3.what a plugin cannot do?
Cannot create toolbars.Cannot affect browser menus.
In a word,it just a part of a web page.
Above reference:
http://colonelpanic.net/2010/08/browser-plugins-vs-extensions-the-difference/4.how plug-ins work?
STEP 2: the host browser calls the NP_Initialize function of the library and passes a reference to the public API of the browser (i.e. the NPNetscapeFuncs starting with NPN_ in the Mozilla documentation). The host browser also calls the NPP_New function in order to instantiate a "plugin instance".
STEP 3: the host browser calls the NP_GetValue function (with the variable NPPVpluginScriptableNPObject ) of the library. See step 4.
STEP 4: the plugin calls the NPN_CreateObject (through the reference provided in step 2) to instantiate a "scriptable NPObject". This object serves as proxy to the embed object declared on the source web page.
STEP 5: the web page can interact with the "scriptable object".
Above reference:
http://jldupont.blogspot.com/2009/11/notes-on-npapi-based-plugins.html (need agent)
5.development cost
Use C++ to build
MS Windows: .DLL (Dynamic Link Library) files
Unix: .SO or .DSO (Shared Objects) files
Mac OS X: PPC/x86/Universal loadable Mach-O bundle
Use NPAPI to interact with javascript.
Javascript can judge whether a plugin has been installed.
Javascript can get version of the plugin to judge whether to update.
Javascript can get/set properties of NP object what plugin create.
Javascript can call methods of NP object what plugin create.
In the same time,plugin can also control the elements of dom.
This demo reference in the npruntime Sample Plugin in Visual Studio:
https://developer.mozilla.org/en-US/docs/Compiling_The_npruntime_Sample_Plugin_in_Visual_Studio
there it teach you to establish the engineering in visual studio.
6.1 result screenshot
however,it cannot run on chrome
so,i found another example.
http://npapi-chrome-plugin-helloworld-example.googlecode.com/svn/trunk
after testing,it can run on firefox,chrome and opera.
Personal stage summary...