I have a strange behavior on the iPhone browser. Is there a tool to debug the JavaScript of the iPhone browser?
我在iPhone浏览器上有一个奇怪的行为。有工具可以调试iPhone浏览器的JavaScript吗?
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?
我希望有比简单的alert()消息更高级的东西。是否有一些高级工具,比如设置断点和查看对象状态?
5 个解决方案
#1
40
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.
随着iOS 6的发布,苹果为他们的移动Safari浏览器发布了远程Web Inspector,这是巨大的。基本上,在普通的Safari浏览器中,你拥有所有Web Inspector的功能和强大功能,适用于你的移动应用程序,包括Phonegap应用程序。
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.
我使用过weinre,但是这个工具对于更新的iOS版本来说已经过时了(不幸的是,对于老版本的iOS,非iOS设备,或者如果你在Windows上的话),因为它是一个功能齐全的调试器,有断点等等。
Requirements:
- A Mac with Safari 6+
- 一个带Safari 6+的Mac电脑。
- Either a USB-attached iOS 6+ device or xCode 4.5+ running an iOS 6+ simulator
- 要么是usb连接的iOS 6+设备,要么是运行iOS 6+模拟器的xCode 4.5+
How to activate the inspector:
- In your simulator or device, open Settings > Safari > Advanced > Web Inspector > On
(this is on by default in the simulator) - 在您的模拟器或设备中,open Settings > Safari >高级> Web Inspector > On(在模拟器中默认为On)
-
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.
在Mac的Safari 6+中,从“开发”菜单中访问页面。如果未显示,您可以在Safari的高级首选项中启用“开发”菜单。
More discussion at the bottom of:
http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers
更多的讨论在底部:http://www.mobilexweb.com/blog/iphone-5-ios-6-html5开发者
(Also, if you read about a "secret private interface" or iWebInspector somewhere, these are also made obsolete.)
(另外,如果您在某些地方读到“秘密专用接口”或iWebInspector,这些接口也会被淘汰。)
#3
1
you can also inject firebug using a simple bookmark. I've used it on the ipad and my debugging abilities were immensely enhanced.
您还可以使用一个简单的书签来注入firebug。我在ipad上使用过它,我的调试能力得到了极大的提高。
#4
1
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).
我遇到了一个简单的用例,我只需要在Safari的JS引擎上测试我的代码(仅仅调试,简单地运行它并消耗跟踪)。
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.
为此,我使用了Epiphany web浏览器,它是免费的,并且使用了JavaScriptCore JS引擎,Safari也使用了这个引擎。Epiphany没有提供开发工具,所以我使用http://jsconsole.com/来查看我的跟踪。
Though it is a thin solution, it helped me find a line which worked on Chrome but didn't on Safari.
虽然这是一个很薄的解决方案,但它帮助我找到了一个在Chrome上工作但在Safari上没有的行。
#5
0
Step by Step Guide How To Enable JavaScript in iPhone
逐步指导如何在iPhone中启用JavaScript。
- Open your iPhone settings.
- 打开你的iPhone设置。
- Tap on safari in the app list.
- 在app列表中点击safari。
- Tap on Advanced option.
- 点击高级选项。
- Enable Javascript iPhone with the help of switch push.
- 在切换按钮的帮助下启用Javascript iPhone。
#1
40
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.
随着iOS 6的发布,苹果为他们的移动Safari浏览器发布了远程Web Inspector,这是巨大的。基本上,在普通的Safari浏览器中,你拥有所有Web Inspector的功能和强大功能,适用于你的移动应用程序,包括Phonegap应用程序。
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.
我使用过weinre,但是这个工具对于更新的iOS版本来说已经过时了(不幸的是,对于老版本的iOS,非iOS设备,或者如果你在Windows上的话),因为它是一个功能齐全的调试器,有断点等等。
Requirements:
- A Mac with Safari 6+
- 一个带Safari 6+的Mac电脑。
- Either a USB-attached iOS 6+ device or xCode 4.5+ running an iOS 6+ simulator
- 要么是usb连接的iOS 6+设备,要么是运行iOS 6+模拟器的xCode 4.5+
How to activate the inspector:
- In your simulator or device, open Settings > Safari > Advanced > Web Inspector > On
(this is on by default in the simulator) - 在您的模拟器或设备中,open Settings > Safari >高级> Web Inspector > On(在模拟器中默认为On)
-
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.
在Mac的Safari 6+中,从“开发”菜单中访问页面。如果未显示,您可以在Safari的高级首选项中启用“开发”菜单。
More discussion at the bottom of:
http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers
更多的讨论在底部:http://www.mobilexweb.com/blog/iphone-5-ios-6-html5开发者
(Also, if you read about a "secret private interface" or iWebInspector somewhere, these are also made obsolete.)
(另外,如果您在某些地方读到“秘密专用接口”或iWebInspector,这些接口也会被淘汰。)
#2
#3
1
you can also inject firebug using a simple bookmark. I've used it on the ipad and my debugging abilities were immensely enhanced.
您还可以使用一个简单的书签来注入firebug。我在ipad上使用过它,我的调试能力得到了极大的提高。
#4
1
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).
我遇到了一个简单的用例,我只需要在Safari的JS引擎上测试我的代码(仅仅调试,简单地运行它并消耗跟踪)。
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.
为此,我使用了Epiphany web浏览器,它是免费的,并且使用了JavaScriptCore JS引擎,Safari也使用了这个引擎。Epiphany没有提供开发工具,所以我使用http://jsconsole.com/来查看我的跟踪。
Though it is a thin solution, it helped me find a line which worked on Chrome but didn't on Safari.
虽然这是一个很薄的解决方案,但它帮助我找到了一个在Chrome上工作但在Safari上没有的行。
#5
0
Step by Step Guide How To Enable JavaScript in iPhone
逐步指导如何在iPhone中启用JavaScript。
- Open your iPhone settings.
- 打开你的iPhone设置。
- Tap on safari in the app list.
- 在app列表中点击safari。
- Tap on Advanced option.
- 点击高级选项。
- Enable Javascript iPhone with the help of switch push.
- 在切换按钮的帮助下启用Javascript iPhone。