Is there a way to debug JavaScript in the iPhone/iOS Safari browser?

前端 未结 5 1685
闹比i
闹比i 2020-12-13 09:15

I have a strange behavior on the iPhone browser. Is there a tool to debug the JavaScript of the iPhone browser?

I\'m hoping there\'s something more advanced than s

5条回答
  •  青春惊慌失措
    2020-12-13 09:44

    With the release of iOS 6, Apple released Remote Web Inspector for their Mobile Safari, and this is huge. Basically you have all the features and power of Web Inspector in regular Safari, for your mobile apps, including Phonegap apps.

    I've used weinre but this tool makes it obsolete for newer versions of iOS (unfortunately not for old versions of iOS, non-iOS devices, or if you're on Windows) since its a full-featured debugger with breakpoints and everything.

    Requirements:

    1. A Mac with Safari 6+
    2. Either a USB-attached iOS 6+ device or xCode 4.5+ running an iOS 6+ simulator

    How to activate the inspector:

    1. In your simulator or device, open Settings > Safari > Advanced > Web Inspector > On
      (this is on by default in the simulator)
    2. In Safari 6+ for Mac, access your page from the Develop menu. You can enable Develop menu in Safari's Advanced Preferences if its not showing up.

    More discussion at the bottom of:
    http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers

    (Also, if you read about a "secret private interface" or iWebInspector somewhere, these are also made obsolete.)

提交回复
热议问题