I am developing a Windows 8.1 application in HTML5 and Javascript (Silverlight). I have got stucked in hardware back button functionality.
In MainPage.xaml.cs Codebehind file i want to call a javascript function from following method:
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
// Here i want to call a javascript function
}
Here is the answer:
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
Browser.InvokeScript("functionName");
}
And parameter can also be passed from here like this:
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
Browser.InvokeScript("functionName","param1");
}