Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Forcing a page to render in standards mode using a BHO

43 views
Skip to first unread message

Jonny

unread,
Nov 19, 2011, 2:34:06 PM11/19/11
to
I am creating a BHO which injects some code into certain web pages. I
created it to support IE8 and up, however, some of the pages that I
need to inject code into don't have a DOCTYPE tag and thus the pages
are being rendered with the IE6 engine (i.e., in Quirks mode). I need
to figure out some way to force these pages to be rendered with the
latest engine.

I have looked through the documentation for the InternetExplorer and
IWebBrowser2 objects and I cannot find any methods or properties which
allow for the document mode to be set.

The method that I have been trying to implement is to inject a "X-UA-
Compatible: IE=edge" header into the response for certain. To this
end, I have been experimenting with Igor Tandetnik's PassthruAPP, as I
have learned from several different sources that it is possible to
modify the response headers by reimplementing the HTTP and HTTPS
protocols. However, I have reached a dead end with this approach
because I can't for the life of me figure out how to actually modify
the response headers. I have a working version of the PassthruAPP
loaded up in my BHO, and I know how to intercept the headers (in the
OnResponse method), but it doesn't seem like I am able to modify the
headers from there as well.

It seems like another possible approach is to create a new key/value
inside of the FeatureControl key in the registry, but I'm not sure how
or even if that would work.

So at the moment I'm pretty stumped. Any help would be extremely
appreciated.

Thanks!

Bjoern Hoehrmann

unread,
Nov 19, 2011, 3:14:09 PM11/19/11
to
* Jonny wrote in microsoft.public.inetsdk.programming.webbrowser_ctl:
>I have looked through the documentation for the InternetExplorer and
>IWebBrowser2 objects and I cannot find any methods or properties which
>allow for the document mode to be set.

That is my understanding aswell. There are registry settings that can be
used to http://msdn.microsoft.com/en-us/library/ee330730 change the mode
for a whole process, and the F12 developer tools can modify the mode for
a tab, but apparently there is no good API for this and neither would be
a good choice for per-document changes.
--
Björn Höhrmann · mailto:bjo...@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
0 new messages