none
My HTML5 app can't work on VS (Windows Phone 8.1 HTML App Project), I want to debug the JS errors but I cant figure it out

    Question

  • My HTML5 app can't work on VS (Windows Phone 8.1 HTML App Project), I want to debug the JS errors but I cant figure it out how to do it. It seems the error is about Cross origin requests (the framework loads pages in the same folder), because it occur too when I put it on an Android webview but they have the configuration to enable it. Any help is appreciated
    Wednesday, December 14, 2016 10:07 AM

All replies

  • Hi Farrell Raafi,

    How do you use your JS in your Windows Phone 8.1 App Project?

    If the JS script is write in JS file and you reference this JS file in a HTML page, then you can debug this JS file with following steps.

    1. Right-Click your Windows Phone 8.1 project and choose the Debug tab.
    2. Set the Debugger Type for Application process and Background task process as "Script".
    3. Then add breakpoints in your JS file and it will be hit when debugging the app on Windows Phone emulator.

    But after you set the Debugger type as "Script", the breakpoints in C# code will not be hit.

    If you write the JS script in HTML directly, I'm afraid that we could not debug the JS code through Visual Studio directly when running the app on Windows Phone emulator/device. But you could right-click the HTML file and choose "View in Browser". Then you could press F12 to open the IE debugger tool to debug the JS code.

    Best Regards,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 15, 2016 6:15 AM
    Moderator
  • Thank you for the answer and now I figure it out to debug it with IE and Edge, it turn out true that the problem is the WP 8.1 webview requires an http:// type protocol for HTML5 apps, can I enable the settings to allow file:// protocol access like on the android one (there are a boolean named setAllowFileAccessFromFileURLs)? 
    Thursday, December 15, 2016 9:11 AM
  • Hi Farrell Raafi,

    I'm glad that you have figure out how to debug the JS code with IE and Edge. Please mark the helpful reply as answer, which is benefit to other communities who has the same problem.

    >> can I enable the settings to allow file:// protocol access like on the android one (there are a boolean named setAllowFileAccessFromFileURLs)? 

    Since this forum is discuss Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.

    About how to allow file:// protocol access in Windows Phone 8.1 app, I suggest you post this issue to Windows Phone development forum to get a better help. Thanks for your understanding.

    https://social.msdn.microsoft.com/Forums/windowsapps/en-US/home?forum=wpdevelop

    Best Regards,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 15, 2016 9:25 AM
    Moderator
  • Ok thanks for the answer
    Thursday, December 15, 2016 9:30 AM
  • Hi Farrell Raafi,

    Thanks for your response.

    Please mark the thread through click the "Marks as answer" hyperlink on the reply, which could close this thread if the problem has been resolved :)

    Thanks,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 15, 2016 9:38 AM
    Moderator