Is there a way to enable the JavaScript Error/Debug Console for Safari within Android?

后端 未结 6 1069
栀梦
栀梦 2020-11-29 01:41

I\'m developing a JavaScript application that needs to run on the Google Android Phone OS. Is there a way to enable the JavaScript Error/Debug console within Safari on eith

相关标签:
6条回答
  • 2020-11-29 01:51

    You can view the log and much more with weinre

    From the Weinre docs

    weinre is a debugger for web pages, like FireBug (for FireFox) and Web Inspector (for WebKit-based browsers), except it's designed to work remotely, and in particular, to allow you debug web pages on a mobile device such as a phone.

    0 讨论(0)
  • 2020-11-29 01:54

    It looks like, with the Android 2.0.1 SDK you'll need to filter on "browser" instead of "WebCore"

    0 讨论(0)
  • 2020-11-29 02:02

    I know your question is about Safari, but you might want to look into using Chrome instead. You can now use Chrome's desktop developer tools to debug and profile apps on your Android device.

    Here's how:

    1. On Android Chrome, go to settings -> Developer tools and check "Enable USB Web debugging"
    2. On the desktop, run adb forward tcp:9222 localabstract:chrome_devtools_remote
    3. Now on Desktop Chrome, navigate to localhost:9222.

    You should see a list of the pages you have open on your phone. Click the one you want to debug/profile.

    Detailed instructions are here

    0 讨论(0)
  • 2020-11-29 02:07

    On Android write about:debug on the address line when the current page is the page you want to debug. you will get access to the console.

    0 讨论(0)
  • 2020-11-29 02:08

    I have discovered that you can get this debugging information on the phone itself, without needingn to use adb or plug it into a computer, just download a log viewer.

    Check the link for more info.

    0 讨论(0)
  • 2020-11-29 02:18

    A quick Google turns up this blog post (posted after you asked your question), that should at least let you see any Javascript errors via the Android Debug Bridge using the command:

    adb logcat WebCore:V *:S
    

    Not quite the same as a full debug console though.

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