共用方式為


getHostEnvironmentValue method

Provides information on the specified characteristic(s) of the user's system. This is a convenience API that bundles relevant host information already exposed through various sources on the Windows system.

Important

This method is only available in Microsoft Edge. It is not supported in Internet Explorer.

Syntax

var retval = external.getHostEnvironmentValue(name);

Parameters

name[in]

Type: string (or string array)

The system property to query. One or more of the following values:

Note
See GetProductInfo function for further details.
Query string Example value
"browser-name" "Microsoft EdgeHTML"
"browser-platform-version" "14.14393"
"browser-version" "38.14393.0.0"
"device-dpi" "96"
"device-logical-processors" "8"
"device-max-touch-points" "10"
"device-pixel-height" "1200"
"device-pixel-width" "1920"
"device-role" "3"
Note
See PLATFORM_POWER_ROLE for the enumeration value key.

"device-sku" "4"
"os-architecture" "AMD64"
"os-build" "10.0.14393"
"os-language" "en-us"
"os-manufacturer" "Microsoft Corporation"
"os-mode" "0" (Unlocked)
"os-sku" "Enterprise Edition"
Note
See GetProductInfo function for further details.

Return value

Type: DOMString or sequence<DOMString>

The queried property value(s), serialized as JSON key/value pairs

Remarks

This method will throw an error if called with no parameters and return null if called with one or more non-matching parameters to the list above.

This snippet shows how to query multiple values.

var validItems = [
    "browser-name",
    "browser-platform-version",
    "browser-version",
    "device-sku",
    "device-dpi",
    "device-logical-processors",
    "device-max-touch-points",
    "device-pixel-height",
    "device-pixel-width",
    "device-role",
    "os-architecture",
    "os-build",
    "os-language",
    "os-manufacturer",
    "os-mode",
    "os-sku"
];

var allData = JSON.parse(window.external.getHostEnvironmentValue(validItems));

See also

external