msIsSiteMode method

Determines whether the current page was launched as a pinned site.

 

Syntax

*object.*msIsSiteMode(pfSiteMode)

Parameters

  • pfSiteMode [out, retval]
    Type: VARIANT_BOOL

    Returns true if the current page was launched as a pinned site; false otherwise.

Return value

Type: Boolean

Returns true if the current page was launched as a pinned site; false otherwise.

Remarks

You can use this method to configure your webpages differently if they are running as a pinned site versus the normal browser mode.

Only pages within the same domain as the pinned site start URL are considered to be part of the pinned site. If a page from a different domain is opened inside the pinned site window, then IShellUIHelper4::msIsSiteMode returns false.

To pin a site, Windows Internet Explorer requires Windows 7 or later.

Examples

The following script redirects to a start page if the current window is already running as a pinned site. The try/catch statement allows the script to recover gracefully if the call is not supported by the browser.

function testSiteMode()
{
    try {
        if (window.external.msIsSiteMode()) {
            location.href = startPage;
        }
    }
    catch(ex) {
        alert("Site Mode is not supported.");
        return;
    }
}
window.onload = testSiteMode;

See also

window

external

IShellUIHelper4::msAddSiteMode