Features and restrictions by context (HTML)
[ This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation ]
Learn about the features available to pages in the local and web contexts.
A Windows Runtime app using JavaScript contains at least one HTML page. That page, and any other pages you include in the app itself, generally run in the app's local context. When you use an iframe to navigate to a remote page, that page runs in the web context and has limited access to your system.
You can use the ApplicationContentUriRules section of the app's package manifest to give a page in the web context access to your system's geolocation devices (if your app has permission to access this functionality), as well as access to the clipboard.
General features and restrictions
This table describes some of the features and restrictions that are available depending on whether the page is running in the local or web context.
Feature | Local context | Web context |
---|---|---|
Windows Runtime | Yes | No |
Windows Library for JavaScript | Yes | Yes*
(See the Windows Library for JavaScript in the web context section for details.) |
JavaScript URIs
(attribute |
No
A URI can refer to defined JavaScript functions ( |
Yes |
Data URIs ("data:" ) for fonts | No | Yes |
External script references (<script src="http://*" /> ) | No
Script must come from locally packaged content. |
Yes |
window.close | Yes
Important While you can technically use window.close in a local context, we don't recommend it. It will generate an error and cause the Windows Store to reject the app.
|
No |
Cross-domain XHR requests | Yes | No |
Automatic toStaticHTML validation | Yes | No |
Application Cache | Yes | Yes |
Cross-domain XHR requests | Yes | No |
Windows Library for JavaScript in the web context
Although you can use WinJS in the web context, some of its APIs work differently because the web context does not have access the Windows Runtime. Here are some of the APIs that are affected:
API | Behavior changes in the web context |
---|---|
WinJS.UI.AppBar |
|
WinJS.UI.ListView |
|
WinJS.UI.Rating |
|
WinJS.UI.SettingsFlyout |
|
WinJS.UI.StorageDataSource |
|
WinJS.UI.ToggleSwitch |
|
WinJS.UI.Tooltip |
|