Windows Phone 8 IE10 Javascript debugging

前端 未结 3 1589
不思量自难忘°
不思量自难忘° 2020-12-13 19:23

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

相关标签:
3条回答
  • 2020-12-13 20:03

    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.

    What I personally use on daily basis

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

    2. Weinre remote debugger. Demo video. You can use the following app based on Weinre to simplify its usage (no local setup needed) - IeMobileDebugger src or 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

    index.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

    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);
        };           
    }
    
    0 讨论(0)
  • 2020-12-13 20:07

    FWIW: Windows Phone 8.1 finally supports remote debugging. See http://blogs.msdn.com/b/visualstudioalm/archive/2014/04/04/diagnosing-mobile-website-issues-on-windows-phone-8-1-with-visual-studio.aspx

    0 讨论(0)
  • 2020-12-13 20:11

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

    0 讨论(0)
提交回复
热议问题