osx - Is it possible to debug javascript on iOS Safari using the desktop Web Inspector?

07
2014-07
  • Mordred

    First, let me say that I know all about the iOS simulator, and have no problems using the Safari Web Inspector to debug javascript using Safari and the simulator. That works fine.

    My issue is that I've got some javascript on a website that runs perfectly fine in Chrome's emulation and the iOS Simulator. Where it doesn't seem to work is on my actual iPad. I wanted to debug the page using the web inspector by setting breakpoints in the javascript, but those breakpoints never get hit. The code is executing because I can inspect some of the values in the console, but breakpoints on those same lines don't get hit. I tried it on multiple scripts, including jQuery, and all breakpoints were ignored. I tried this on a couple webpages and the results were the same. No, the breakpoints aren't disabled.

    Is it possible to set breakpoints in Javascript running on a physical device? I feel like I was able to do this before, but it's possible I was just doing all my debugging using the iOS simulator. If it is possible, does anyone have any ideas of why my breakpoints all seem to be ignored?

    I'm using iOS 7, OSX 10.8.5 and the latest version of XCode and Safari (updated both today).

  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    osx - Is it possible to put Safari 4's tabs on top of the window?
  • dbr

    In the Safari 4 betas, the tab bar was moved to the top of the window, rather than underneath the address/bookmark bar:

    Safari 4 Beta's tabs

    Is there any way to get this back in the current Safari 4.0.3 (non-beta release)?

    I can only find the command to disable this feature in the betas:

    defaults write com.apple.Safari DebugSafari4TabBarIsOnTop -bool NO
    

    Changing NO to YES has no effect with the current version.


  • Related Answers
  • redacted

    You can do it, but it requires some hacking. You need to have the beta installer.

    1. Install Safari 4 final
    2. Using pacifist extract only the Safari application from the beta installer.
    3. Replace the final Safari.app with the beta Safari.app - do not replace any system files!
    4. You should be able to launch the application now, using the new safari system files and the beta application (with tabs on top etc.)

    Here is a link to a guide:

    MacOSX Hints with some basic info, see the comments for more details

    The article references Pacifist, an application which allows you to work with installer .pkg files. While it is paid the demo should be enough to complete the changes needed.

    You should probably keep a copy of the application somewhere, as any Safari update will overwrite it again.

  • Rich Bradshaw

    No. The design choice was reversed. None of the beta settings apply to the final.

  • Chris Tarazi

    It is not changing YES to NO or vice versa, it is changing them to FALSE or TRUE, vice versa.

    http://lifehacker.com/5161005/put-safari-4-betas-tabs-back