I want to make own browser application with own value of User-Agent.
Browser based on CHtmlView. MFC.
But exist strange problem with User-Agent from Ajax requests...
I did:
User-Agent value is used as argument to Navigate(). A Navigate() requests use right User-Agent.
Overload of OnAmbientProperty() method of CHtmlView class.
BOOL MyHtmlView::OnAmbientProperty(COleControlSite *pSite,
DISPID dispid, VARIANT *pvar)
{
USES_CONVERSION;
// Change user agent for this web browser host during hyperlinks
if (dispid == DISPID_AMBIENT_USERAGENT)
{
pvar->vt = VT_BSTR;
pvar->bstrVal = ::SysAllocString(m_userAgent);
return TRUE;
}
return CHtmlView::OnAmbientProperty(pSite, dispid, pvar);
}
This solve problem with hyper link.
But I have to use this browser for some Ajax application. And here is problem. For Ajax requests it use original IE User-Agent value.
My PC is WinXP based with IE7.
Any idea how to solve this? How to change User-Agent for any request from my browser?
Thanks!