IE MIME/内容过滤 [英] IE MIME/content filtering

查看:93
本文介绍了IE MIME/内容过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究开发IE6 +扩展的方法,该扩展将允许处理自定义MIME类型.

I'm looking into ways to develop an extension for IE6+ that will allow handling of custom MIME types.

作为一个示例,我需要能够获取服务器返回的具有自定义MIME类型的文档,对其进行一些处理,然后再将MIME类型更改回IE可以本地处理的内容,例如为text/html或image/jpeg.

As an example, I need to be able to take a document with a custom MIME type that is returned by the server, perform some processing on it, and then change the MIME type back to something that IE can natively handle, such as text/html or image/jpeg.

我对urlmon MIME过滤器很熟悉,但是它们有一个很大的弱点.只会为顶层文档调用它们,而不会为任何其他页面内容(例如图像等)调用它们.

I am familiar with the urlmon MIME filters, but they have a huge weakness; they are only invoked for the top level document, and not for any of the additional page content such as images and the like.

我能想到的一种工作方式是使用vtable/iat补丁钩住HTTP/S协议处理程序,类似于Google Gears的工作方式,以便能够拦截响应标头并修改标头接收到具有指定MIME类型的文档时的响应和响应正文.

The one way that I can think of that will work is to hook the HTTP/S protocol handlers using vtable/iat patches, similar to the way Google Gears works, to be able to intercept the response headers, and modify the headers and response body when a document with the specified MIME type is received.

我想知道是否还有其他人对如何以一种不太hacky/侵入性的方式实现这一目标有什么好主意.

I'm wondering if anybody else has any good ideas on how this could be accomplished in a less hacky/intrusive way.

只是以为我会跟进此事,并提到我将vtable补丁带到了HTTP/S协议处理程序中,并且它的工作比我预期的要好得多.如果有人想做这样的事情,我强烈建议您看一下Google Gears中的HttpHandlerPatch类,以获取一些启发.

Just thought I'd follow up on this and mention that I went with the vtable patch into the HTTP/S protocol handlers, and it worked much better than I expected. If anybody else is looking to do something like this, I highly recommend taking a look at the HttpHandlerPatch class in Google Gears for some inspiration.

推荐答案

几年前,我基于一本名为《 VB6中的Shell编程》的书,编写了此类扩展,BHO,IE工具栏等.我使用的书就是这本书: http://oreilly.com/catalog/9781565926707/告诉您如何挂钩和陷阱进入IE的消息.我写了一种屏幕抓取器(后渲染样式不像不首先执行javascript的蜘蛛一样).它基于IE5,但扩展程序仍可与IE6一起使用.我可能仍然有VB6源.不过,我不建议您将其升级到.Net.

Several years ago, I wrote such extensions, BHO, IE toolbars, etc., based on a book called Shell Programming in VB6. The book I used is this one: http://oreilly.com/catalog/9781565926707/ This book tells you how to hook and trap messages coming into IE. I wrote a kind of screen scraper (post-render style not like a spider that doesn't execute the javascript first). It was based on IE5 but the extensions still work with IE6. I probably still have the VB6 source somewhere. I am not offering to upgrade it to .Net for you though.

PS. Haroeris Astrum在该页面上的评论由我:)

PS. The review on that page by Haroeris Astrum is by me :)

这篇关于IE MIME/内容过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆