Why do Kango or Crossrider not fit your needs? Both frameworks allow you to manipulate the page's DOM (which is what you want):
- Kango: Adding content script
- Crossrider: documentation, example code
If you want to code your own solution, take a look at the relevant documentation:
- Content scripts (Chrome)
- The Page mod Jetpack API (Firefox)
- Injected scrips (Safari)
- Injected scripts (Opera)
Internet Explorer does not natively support extensions. It took me about 80 hours to create a stable and reliable IE extension which supports cross-site AJAX, a (preference) storage method and injection of scripts as early as possible in any frames based on its URL. I developed and tested the extension with Visual Express 2010 on Windows XP and Windows 7, for IE 8-10 (the extension might work on IE6/7, but I decided to not support these ancient and rarely used browsers).
First, I wrote an extension in C# based on LiveReloadIEExtension (a sample IE extension, which in turn is based on this Stack Overflow answer - see also this blog post). It was functional, but it required .NET 4, lacked support of frames, and it's relatively slow.
So, I decided to write an IE extension from scratch in C++. A good starting point is available at http://www.wischik.com/lu/programmer/bho.html: Sample code for C++ BHO, which changes the document's background based on key/mouse events. I've also learned a lot by looking at other code samples on CodeProject, topics on the MSDN forums, questions and answers on Stack Overflow, lots of other blogs, and the MSDN documentation:
- DWebBrowserEvents2 interface lists several events which you use to find an appropriate injection point.
- Scripting Object Interfaces (MSHTML) lists even more interfaces. You'll be mainly interested in the
iHTMLDocument
,iHTMLDocument2
, ... interfaces.
After creating the IE extension, you want to deploy it of course. I used Wix toolset to create a MSI.