Chrome Extensions and NPAPI
There are more details up on the Chrome wiki for how to build a Chrome extension thanks to illustrious Aaron Boodman.
You create a JSON manifest in your extension directory, tell Chrome about it via –enable-extensions –load-extension="c:myextension" (only required while extensions are in dev mode) and then you can navigate to chrome-extension://00123456789ABCDEF0123456789ABCDEF0123456/hello_world.html assuming the manifest of:
PLAIN TEXT
JAVASCRIPT:
1. |
2. { |
3. "format_version": 1, |
4. "id": "00123456789ABCDEF0123456789ABCDEF0123456", |
5. "version": "1.0", |
6. "name": "My First Extension", |
7. "description": "The first extension that I made." |
8. } |
Aaron’s work wouldn’t be complete with some notion of userscripts, and the document discusses that:
PLAIN TEXT
JAVASCRIPT:
1. 2. { 3. "format_version": 1, 4. "id": "00123456789ABCDEF0123456789ABCDEF0123456", 5. "version": "1.0", 6. "name": "My First Extension", 7. "description": "The first extension that I made.", 8. "content_scripts": [ 9. { 10. "matches": ["http://www.google.com/"], 11. "js": ["foo.js"] 12. } 13. ] 14. } 15. |
Finally, NPAPI plugins are supported for the binary side of the house, and you just need to point to the location of that code via "plugins_dir": "plugins".
There are also more resources:
* API Pattern
* Manifest details
* Todo list example
* Userscripts
Not your mothers JavaScript
The Chrome team has also launched a new website to showcase interesting web app examples and samples.
Calling it openwebexperiments or something, and being a bit more inclusive would have been nice (since these all seem to work fine in Safari, Firefox, etc ….. but the idea is good!