Win8 JS Privacy Policy Settings


As part of the Windows 8 App Store requirements, if your app has internet/network connectivity then you’re required to not only have a privacy policy in your app store description, but also as a Charms menu item. Unfortunately all the docs suck for how to add a simple charms menu item to open the privacy policy in a new window using JavaScript 🙂

After lots of digging, I’ve come up with a simple bit of JavaScript code, that should also let you add other Charms Settings menu settings without tearing your eyes out trying to read the docs.

var settingsPane = Windows.UI.ApplicationSettings.SettingsPane.getForCurrentView();
function commandsRequested(eventArgs) {
var applicationCommands = eventArgs.request.applicationCommands;
var privacyCommand = new Windows.UI.ApplicationSettings.SettingsCommand('privacy', 'Privacy Policy', function() {
window.open('www.link.to.your/privacy_policy.html');
});
applicationCommands.append(privacyCommand);
}
settingsPane.addEventListener("commandsrequested", commandsRequested);

  1. #1 by Mike on 2013-05-30 - 12:50 am

    Where would this function be placed to call in the privacy policy?

    • #2 by Eion Robb on 2013-05-30 - 3:06 pm

      You can put it anywhere in your JavaScript. Personally, I put it at the end of my cordova.js file

  2. #3 by Alif on 2013-12-22 - 9:29 am

    can you give me an example about this line of code? window.open(‘www.link.to.your/privacy_policy.html’);

Comments are closed.