Skip to main content
ATL Server Library Reference 
IBrowserCaps Interface 

This interface provides methods for determining the capabilities of a browser.


__interface __declspec( uuid( "3339FCE2-99BC-4985-A702-4ABC8304A995" ))
IBrowserCaps :
   public IUnknown

An object implementing this interface can be obtained by calling one of the IBrowserCapsSvc methods.

Header: atlsiface.h

CComPtr<IBrowserCaps> m_spBrowserCaps;

[ tag_name(name = "LoadBrowserCaps") ]
HTTP_CODE OnLoadBrowserCaps()
{
    // Get the IBrowserCapsSvc service from the ISAPI extension.
    CComPtr<IBrowserCapsSvc> spBrowserCapsSvc;
    if (FAILED(m_spServiceProvider->QueryService(
                    __uuidof(IBrowserCapsSvc), &spBrowserCapsSvc)))
    {
        return HTTP_FAIL;
    }

    // Get user agent string from the query parameters.
    LPCSTR szUserAgent = m_HttpRequest.QueryParams.Lookup("UserAgent");
    if (szUserAgent != NULL)
    {
        // Get the browser capabilities for the specified user agent.
        if (FAILED(spBrowserCapsSvc->GetCapsUserAgent(
                             CComBSTR(szUserAgent), &m_spBrowserCaps)))
        {
            return HTTP_FAIL;
        }
    }
    else
    {
        // Get the browser capabilities for the user's current user agent.
        if (FAILED(spBrowserCapsSvc->GetCaps(m_spServerContext,
                                                       &m_spBrowserCaps)))
        {
            return HTTP_FAIL;
        }
    }

    return HTTP_SUCCESS;
}