WP7 webBrowser 控件中的 Javascript 错误!
我需要开发一个 WP7 应用程序,它有一个 Microsoft.Phone.Controls.WebBrowser 控件,我将其加载事件设置为:
wb.IsScriptEnabled = true;
string game_address = "http://192.168.1.26/start.html";
wb.Source = new Uri(game_address);
start.html 是一个 HTML5 应用程序,当我在模拟器中运行此应用程序时,此应用程序不是也可以运行,但它会输出任何热量。
但是我在Emulaor的IE9中打开这个HTML5应用程序,它工作了!
我开发了一个 C# 桌面应用程序作为测试。使用相同的网络浏览器控件和事件代码,它会给出 JavaScript 错误警报“预期标识符、字符串或数字”! 我设置了wb.ScriptErrorsSuppressed = true,错误警报没有出现,但HTML5应用程序仍然无法工作!
我可以在我的 Windows IE9 和其他浏览器(如 Chrome 和 FF)中打开当前的 HTML5 应用程序。
I need to develop a WP7 app, it has a Microsoft.Phone.Controls.WebBrowser control, and i set it's loaded event as:
wb.IsScriptEnabled = true;
string game_address = "http://192.168.1.26/start.html";
wb.Source = new Uri(game_address);
start.html is a HTML5 app, and when i run this app in the Emulator, this app is not run as well, but it's output any warming.
But I open this HTML5 app in the IE9 of Emulaor, it's work!
I develop a C# desktop application as a test. with the same webbrowser control and event code, it's give a javascript error alert "expected identifier, string or number" !
i set wb.ScriptErrorsSuppressed = true, the error alert is not appear, but the HTML5 app still can't work!
And i can open this HTML5 app current in my windows IE9 and other browsers like chrome and FF.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你能把 javascript 和错误发给我们吗?
不同的浏览器对 javascript 的处理方式不同。可能存在一个浏览器正在处理但另一浏览器未处理的错误。 wp7上的浏览器是手机独有的。
Can you post us the javascript and the error?
Different browsers deal with javascript differently. Possibly there is an error that is being handled by one browser but not by another. The browser on wp7 is unique to the phone.
如果您还创建了一个桌面应用程序来测试它,那么它就不是“网络浏览器控件和事件代码”,因为手机上的浏览器不同。
手机上的 JavaScript 不支持
alert()
。您应该在代码中添加不同的错误报告,以了解出了什么问题。If you also created a desktop application to test this then it wasnt "the webbrowser control and event code" as the browser on the phone is different.
alert()
isn't supported in javascript on the phone. You should look to add different error reporting in your code to see what is going wrong.