有没有办法在 iPhone/iOS Safari 浏览器中调试 JavaScript?
我在 iPhone 浏览器上有一个奇怪的行为。有没有调试iPhone浏览器JavaScript的工具?
我希望有比简单的 alert()
消息更高级的东西。是否有一些高级工具,例如设置断点和查看对象状态?
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 simple alert()
messages. Is there something with advanced tools like setting breakpoints and viewing object states?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
随着 iOS 6 的发布,Apple 为其 Mobile Safari 发布了 Remote Web Inspector,这是一个巨大的成果。基本上,您在常规 Safari 中拥有 Web Inspector 的所有功能和功能,适用于您的移动应用程序,包括 Phonegap 应用程序。
我使用过 weinre,但这个工具对于较新版本的 iOS 来说已经过时了(不幸的是,不适用于旧版本的 iOS、非 iOS 设备,或者如果您使用的是 Windows),因为它是一个完整的工具带有断点和一切的特色调试器。
要求:
如何激活检查器:
(模拟器中默认启用此功能)
在 Mac 版 Safari 6+ 中,从“开发”菜单访问您的页面。如果未显示,您可以在 Safari 的高级首选项中启用“开发”菜单。
底部有更多讨论:
http://www.mobilexweb.com/blog/iphone-5 -ios-6-html5-developers
(此外,如果您在某处读到“秘密私有接口”或 iWebInspector,这些也已过时。)
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:
How to activate the inspector:
(this is on by default in the simulator)
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.)
查看 weinre 或使用远程版本 调试音位间隙。
铜
check out weinre or use the remote version debug phonegap.
cu
您还可以使用简单的书签注入firebug。我在 ipad 上使用过它,我的调试能力得到了极大的增强。
you can also inject firebug using a simple bookmark. I've used it on the ipad and my debugging abilities were immensely enhanced.
我面临一个简单的用例,其中我只需要在 Safari 的 JS 引擎上测试我的代码(仅调试,简单地运行它并消耗跟踪)。
为此,我使用了 Epiphany Web 浏览器,它是免费的,并且使用 JavaScriptCore JS 引擎,Safari 也使用该引擎。
Epiphany 未提供开发人员工具,因此我使用 http://jsconsole.com/ 来查看我的跟踪。
虽然它是一个简单的解决方案,但它帮助我找到了一条在 Chrome 上有效但在 Safari 上无效的线路。
I faced a simple use case in which I only needed to test my code on a Safari's JS engine (Merely debugging, simply running it and consuming traces).
To that end I used Epiphany web browser, which is both free and uses JavaScriptCore JS engine which is also used by Safari.
Epiphany isn't provided with developer tools, so I used http://jsconsole.com/ to view my traces.
Though it is a thin solution, it helped me find a line which worked on Chrome but didn't on Safari.
分步指南 如何在 iPhone 中启用 JavaScript
Step by Step Guide How To Enable JavaScript in iPhone