For Windows 10: I have started a simple grocery list hosted web application. I went through this quick guide and the app works great. I have added a VCD file, the meta tag on my main page and started on the javascript to handle when Cortana activates the app. The app is registering great with Cortana, I can say: "Grocery show the CostCo list" and Cortana recognizes it and shows the app. The problem is that is always shows the home page. I want to have it show the CostCo page when it is activated with voice asking for that list. I put the pages of the app below, if anything else is needed - please let me know. Thank you.
UPDATE I have tried window.location.href = "costco.php"; and in vorlon it shows in the dom explorer the code on Costco.php but it never makes it to the window. Do I have to do some kind of refresh?
My Home Page on the server
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Sample page</title>
<script type="application/javascript">
(function() {
if (typeof Windows !== 'undefined') {
Windows.UI.WebUI.WebUIApplication.addEventListener("activated", function(args) {
var activation = Windows.ApplicationModel.Activation;
if (args.kind === activation.ActivationKind.voiceCommand) {
var speechRecognitionResult = args.result;
var textSpoken = speechRecognitionResult.text;
if (speechRecognitionResult.rulePath[0] === "ShowList") {
if (speechRecognitionResult.semanticInterpretation.properties.apiName[0].search("CostCo") >= 0 || speechRecognitionResult.semanticInterpretation.properties.apiName[0].search("costco") >= 0) {
// WHAT DO I PUT HERE TO HAVE THE APP GO TO
// OR LOAD THE CONTENT FROM HTTP://EXAMPLE.COM/COSTCO.PHP
} else {
console.log("No valid stream specified");
}
} else {
console.log("No valid command specified");
}
}
});
}
})();
</script>
<meta name="msapplication-cortanavcd" content="http://www.example.com/vcd.xml" />
</head>
<body>
</body>
</html>
My VCD File:
<?xml version="1.0" encoding="utf-8"?>
<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.2">
<CommandSet xml:lang="en-us" Name="Grocery">
<CommandPrefix>Grocery</CommandPrefix>
<Example>Grocery show CostCo list</Example>
<Command Name="ShowList">
<Example>Show {message} list</Example>
<ListenFor RequireAppName="BeforeOrAfterPhrase">show {apiName} list</ListenFor>
<Feedback>Loading the {apiName} Grocery list</Feedback>
<Navigate Target="./COSTCO.PHP"/>
</Command>
<PhraseTopic Label="apiName" Scenario="Dictation"></PhraseTopic>
</CommandSet>
</VoiceCommands>