iPad 版 Safari 不报告 Javascript 错误的行号
我正在使用 iPad 2 和 IOs 5 来开发 Web 应用程序。
我已启用开发人员控制台来获取日志,但是当发生 javascript 错误时,它不包含相应的行号。
由于 Web 应用程序处理触摸和手势事件,因此我无法在桌面版本的浏览器上测试它们!
如有任何帮助,我们将不胜感激。
I am using iPad 2 with IOs 5 to develop a web application.
I have enabled the developer console to get logs , but when javascript error occurs it does not include corresponding line number.
Since the web application handles touch and gesture events, I cannot test them on desktop version of the browser!
Any help will be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以添加窗口级错误处理程序
http:// dev.opera.com/articles/view/better-error-handling-with-window-onerror/
并让该控制台记录行号。每个错误您将收到两个控制台日志,但您将对输出有更多控制。
You can add a window level error handler
http://dev.opera.com/articles/view/better-error-handling-with-window-onerror/
and have that console log the line number. You'll be getting two console logs per error, but you will have more control over the output.
您可以尝试使用常规 Safari 或 Chrome 并在使用 iPad 之前先将其写入其中,或者也可以使用 Weinre 应用程序为您提供类似 firebug / chrome 开发人员工具的控制台。
You can try using regular Safari or Chrome and write it there first before using the iPad or alternatively there is the Weinre application that provides you a console like firebug / chrome developer tools.