I have the following problem:
A pluggable protocol handler deliveres HTML files.
These files don't have a proper doctype
- the doctype is completely missing. I can't change this, the files are from a third party.
So I want to use the "X-UA-Compatible: IE=edge
" header to set the doctype. When I do this from a real webserver it works as expected. When I do it from the protocol handler via IHttpNegotiate::OnResponse
it does not work.
I tried already adding more headers like "Content-Type
" and of course "HTTP/1.1 200 OK
" up to the point where I report all headers I receive from a real webbrowser - IE still sets the documentMode
to 5.
Does anybody have some ideas about this?
Here is what I'm trying:
pOIProtSink->ReportProgress(BINDSTATUS_FINDINGRESOURCE, L"Found");
pOIProtSink->ReportProgress(BINDSTATUS_CONNECTING, L"Connecting");
pOIProtSink->ReportProgress(BINDSTATUS_SENDINGREQUEST, L"Sending");
CComQIPtr<IServiceProvider> provider(pOIProtSink);
if (provider) {
CComPtr<IHttpNegotiate> negotiate;
provider->QueryService(IID_IHttpNegotiate, IID_IHttpNegotiate,
(void**)&negotiate.p);
if (negotiate) {
CStringW hdrs;
hdrs.Format(
L"HTTP/1.1 200 OK\r\nContent-Type: %s\r\nX-UA-Compatible: IE=edge\r\n\r\n",
sMime);
negotiate->OnResponse(200, hdrs, L"", NULL);
}
}
pOIProtSink->ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, sMime);
pOIProtSink->ReportData(BSCF_FIRSTDATANOTIFICATION, 0, sz);
pOIProtSink->ReportData(BSCF_LASTDATANOTIFICATION
| BSCF_DATAFULLYAVAILABLE, sz, sz);
pOIProtSink->ReportResult(S_OK, 0, NULL);
And the whole code can be found on github.
Cheers
imagiro