Windows Phone 8 IE10 Javascript 调试

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14567491/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 17:13:35  来源:igfitidea点击:

Windows Phone 8 IE10 Javascript debugging

javascriptwindows-phone-8internet-explorer-10

提问by John Mcfetridge

IE10 has some wonderful enhancements in the HTML5 compliance area but remains a bear to develop JavaScript HTML5 when running on the WP8 as there is no way to debug the app except console messages.

IE10 在 HTML5 合规性方面有一些很棒的增强,但在 WP8 上运行时仍然无法开发 JavaScript HTML5,因为除了控制台消息之外没有其他方法可以调试应用程序。

Is there a remote debugging experience available for IE10 running on WP8 like the WebKit phone browsers have(see my video at http://www.youtube.com/watch?v=GNAjzFpNEj4for example). When this is in place with a USB cable to desktop Safari debugging Javascript apps on IOS is easy as breakpoints can be set and variables examined in the remote debugger . I am hoping the same capabilities are in IE10 and would appreciate any information on where to enable these very much needed capabilities.

是否有像 WebKit 手机浏览器那样在 WP8 上运行的 IE10 的远程调试体验(例如,参见我在http://www.youtube.com/watch?v=GNAjzFpNEj4 上的视频)。当使用 USB 电缆连接桌面 Safari 时,在 IOS 上调试 Javascript 应用程序很容易,因为可以在远程调试器中设置断点和检查变量。我希望 IE10 中具有相同的功能,并希望了解有关在何处启用这些非常需要的功能的任何信息。

回答by Sergei Grebnov

The bad news, that there is no new debug capabilities in comparison to WP7/IE9. Please take a look on How do I debug Internet Explorer on Windows Phone 7?since we are in exactly the same situation on WP8.

坏消息是,与 WP7/IE9 相比,没有新的调试功能。请查看如何在 Windows Phone 7 上调试 Internet Explorer?因为我们在 WP8 上处于完全相同的情况。

What I personally use on daily basis

我个人每天使用的东西

  1. Debug your app in IE10 Desktop as much as possible

  2. Weinreremote debugger. Demo video.You can use the following app based on Weinre to simplify its usage (no local setup needed) - IeMobileDebugger srcor link to Store

    Supports

    Html traversing Html node styles, properties, metrics Reading console output Executing js on device side from console (including intellisense) Dynamic script injection - ability to debug live sites

    Not supported

    js breakpoints

  3. For javascript line by line debugging use aardwolf. Demo with VS integration.

  4. To redirect console trace to Visual Studio output and be able to use console.log("some message") for tracing

  1. 尽可能在 IE10 桌面版中调试您的应用

  2. Weinre远程调试器。演示视频。您可以使用以下基于 Weinre 的应用程序来简化其使用(无需本地设置)- IeMobileDebugger src链接到商店

    支持

    Html 遍历 Html 节点样式、属性、指标 读取控制台输出 从控制台(包括智能感知)在设备端执行 js 动态脚本注入 - 调试实时站点的能力

    不支持

    js断点

  3. 对于 javascript 逐行调试,请使用aardwolf与 VS 集成的演示

  4. 将控制台跟踪重定向到 Visual Studio 输出并能够使用 console.log("some message") 进行跟踪

index.html:

索引.html:

<script type="text/javascript">
    window.console = {
        log: function (str) { window.external.Notify(str); }
    };

    // output errors to console log
    window.onerror = function (e) {
        console.log("window.onerror ::" + JSON.stringify(e));
    };

    console.log("Installed console !");
</script>

MainPage.xaml.cs

主页.xaml.cs

private void Browser_Loaded(object sender, RoutedEventArgs e)
{
    Browser.IsScriptEnabled = true;
    // Add your URL here
    Browser.Navigate(new Uri(MainUri, UriKind.Relative));

    Browser.ScriptNotify += (s, arg) =>
    {
        Debug.WriteLine(arg.Value);
    };           
}

回答by Esko

While not a full solution, Lauri Piispanen's consolelog.js, a nodejs-based remote JS console logger could help you.

虽然不是一个完整的解决方案,但 Lauri Piispanen 的consolelog.js,一个基于 nodejs 的远程 JS 控制台记录器可以帮助你。