IE, Firefox, Safari: Want to write Internet filter: Are there well known "hooks" that I can tie into?
For each of the modern browsers are there well known hooks I can tie into so that I can write an Internet filter while browsing, like an interface where I can write implementations for these types of events:
OnBeginSurf(URL) {
// check URL to see if goes to porn site
}
OnContentFinishedDownloading(HTML) 开发者_StackOverflow{
// check HTML for "bad" content
}
I imagine for IE that I'd write some COM code? I assume Firefox and Safari have some well known interfaces for these things?
Can anyone point me to some web pages that describe this? I couldn't find much by Googling...
Don't try to hook into the browsers to write a content filter.
Write a proxy server. Each browser will HAVE to request web content through your proxy server which will be able to inspect and filter content before it returns to the browser. You get to write your code once and have it work on anything that requests web content.
For IE these are the BeforeNavigate2
, NavigateComplete2
and DocumentComplete
events on the DWebBrowserEvents2
dispinterface of the web browser control.
While I agree with Justin Niessner, that a proxy server is the way to go, but if you goal is protecting children from porn, I think you would probably be better served by using an existing product.
A lot of time and energy has gone into engineering web filters. In addition to compiling large database of prohibited sites, you will need to develop heuristics to guess if an unknown site is safe, advanced filters also do image analysis to determine if an image contains nudity. You also need heavy testing to make sure that the protect can't be easily disabled or circumvented, and constant updates to deal with new sources of adult content.
Unless you have a teem of developers, or plan on working full time for several years, you will have a hard time offering the level of protection of off the shelf solutions.
精彩评论