Skip to main content
ATL Server Library Reference 
IBrowserCapsSvc Interface 

This interface allows you to get access to objects that provide information about the capabilities of a particular user agent (web browser).


__interface
__declspec( uuid( "391E7418-863B-430e-81BB-1312ED2FF3E9" ))
IBrowserCapsSvc :
   public IUnknown

The information about a particular user agent is exposed by the IBrowserCaps interface. Pointers to objects implementing this interface are returned by the IBrowserCapsSvc::GetCaps and IBrowserCapsSvc::GetCapsUserAgent methods.

This interface is implemented by CBrowserCapsSvc.

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;
}