从 windows 应用中的 MainPage.xaml.cs 代码隐藏文件调用 javascript 函数
Calling javascript function from MainPage.xaml.cs codebehind file in windows app
我正在 HTML5 和 [= 中开发 Windows 8.1 应用程序31=] (Silverlight)。我卡在了 硬件后退按钮 功能中。
在 MainPage.xaml.cs 代码隐藏文件中,我想通过以下方法调用 javascript 函数:
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
// Here i want to call a javascript function
}
答案如下:
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
Browser.InvokeScript("functionName");
}
而且参数也可以像这样从这里传递:
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
Browser.InvokeScript("functionName","param1");
}
我正在 HTML5 和 [= 中开发 Windows 8.1 应用程序31=] (Silverlight)。我卡在了 硬件后退按钮 功能中。
在 MainPage.xaml.cs 代码隐藏文件中,我想通过以下方法调用 javascript 函数:
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
// Here i want to call a javascript function
}
答案如下:
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
Browser.InvokeScript("functionName");
}
而且参数也可以像这样从这里传递:
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
Browser.InvokeScript("functionName","param1");
}