How to require an HTTPS connection (Windows Store apps using JavaScript and HTML)

1 out of 3 rated this helpful - Rate this topic

With the "ms-https-connections-only" meta element value you can prevent your Windows Store app using JavaScript from using HTTP connections for navigation or other non-media web content retrievals. When you set this meta element's content attribute to "true", HTTP navigation and non-media web content retrievals will fail.

This meta tag must exist in the head of the your app's home page and must exist at the time that the document fires its load event. This is the only time you can turn on this feature and after you set it, it remains in effect until the next time the app is started. This means that iframe elements in your start page that point to HTTP URIs may load if the iframe exists and begins to load before the document finishes loading.

Prerequisites

Instructions

Step 1: Use an HTTPS connection

Add a meta element to the head of your home page. Set its name to "ms-https-connections-only" and its content attribute to "true".


!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>HTTPS connections example</title>

    <!-- Only use HTTPS connections. -->
    <meta name="ms-https-connections-only" content="true"/>

    <!-- WinJS references -->
    <link href="//Microsoft.WinJS.1.0/css/ui-light.css" rel="stylesheet">
    <script src="//Microsoft.WinJS.1.0/js/base.js"></script>
    <script src="//Microsoft.WinJS.1.0/js/ui.js"></script>

    <!-- Your other script and style references. -->
</head>
<body>
      
    <!-- Your content. --> 
 
</body>
</html>

 

 

Build date: 11/27/2012

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.