msIsSiteMode Method

New for Windows Internet Explorer 9

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

Syntax

bSiteMode = window.external.msIsSiteMode()

Return Value

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 msIsSiteMode returns false.

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

Example

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;

Applies To

external

See Also

msAddSiteMode