Use the npapi to compile a browser plug-in to call programs on the local machine

Source: Internet
Author: User
I am very interested in writing the source code example code of the browser plug-in using the npapi: The plug-in of chrome and Firefox. Almost all of them are about methods and APIs, it's really hard to find a simple code instance that can run! But finally fortunately, finally find an example (http://geeklu.com/2010/10/getting-started-with-npapi-plugin/comment-page-1 ). unfortunately, this example cannot work properly on my Linux machine. so I wrote a new example based on this example, and I also wrote a chrome extension for demonstration. expansion of npapi and chrome: npapi: [1] http://colonelpanic.net/2009/05/building-a-firefox-plugin-part-two/4242] license http://blogold.chinaunix.net/u3/94039/showart_2004756.htm L [4] https://developer.mozilla.org/en/plugins%5] how to use chrome extensions: http://code.google.com/chrome/extensions/npapi.html%6] How to Write chrome extensions: Compile -Some functions in headers/plugin_exec.c: the format of the char * np_getmimedescription () return string must be: "text/html: htm, HTML: HTML document; application/X-texinfo: tex, Texi, texinfo: texinfo document; "For details, see [3] nperrornp_getvalue (void * future, nppvariable variable, void * value). You must process the case where variable is nppvpluginneedsxembed, otherwise, chrome will not enable the plug-in (Firefox is still normal). Demo method: $ CP libplugin_exec.so ~ /. Mozilla/plugins $ Firefox wkt.html $ Google-chrome wkt.html ### enter a command on the webpage (you must run it before you can exit the window, for example, gnome-terminal, otherwise the effect will not be visible ), click "run.

Demonstration Method of chrome Extension: the extension is loaded under the chrome_extension directory (see step 6 of [6] for the loading method ), then, a menu item "save link to/tmp/Link" appears in the right-click menu of each link on the page. log, click this menu item, and the link URL will be saved to/tmp/link. log

 

Finally, I would like to thank my roommate Lei guodong for his active help. The source code for this example is http://u.115.com/file/f23aeb448f. This example is only compiled/tested In Debian SID/ubuntu10.10.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.