在 iPad 上调试 Javascript
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7449317/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Debugging Javascript on iPad
提问by Jeff Fol
I was wondering if there are any useful tools people have found to debug javascript on an iPad which is not jail broken. It is an iPad supplied for work so jail breaking is not an option. Through some tedious steps I have gotten firebug-lite working on the iPad but my debugger statements in the javascript are not being hit. There is also no capability that I am seeing to set breakpoints as you can traditionally with Firebug.
我想知道人们是否找到了任何有用的工具来在没有越狱的 iPad 上调试 javascript。它是为工作提供的 iPad,因此无法越狱。通过一些繁琐的步骤,我已经在 iPad 上使用了 firebug-lite,但是我的 javascript 中的调试器语句没有被命中。我也没有看到像传统上使用 Firebug 那样设置断点的功能。
I also have Safari's debug console open but that is fairly useless for what I am trying to accomplish.
我也打开了 Safari 的调试控制台,但这对我想要完成的工作来说毫无用处。
Thanks for any ideas.
感谢您的任何想法。
采纳答案by Mohsen
Did you look at webkit remote debugging protocol? It seems they know people want a debugger for their iPad but still no real world native iPad remote debugger is available out there.
你看webkit远程调试协议了吗?似乎他们知道人们想要为他们的 iPad 安装调试器,但在现实世界中仍然没有可用的本地 iPad 远程调试器。
But don't get disappointed, there is a tool called weinrethat doing what webkit folks willing to do in the future right now!
但是不要失望,有一个叫做weinre的工具可以做 webkit 人们现在愿意做的事情!
Update:
更新:
By release of Google Chrome for Android phones remote debuggingand tablets debugging mobile web apps is no pain anymore. You will need an expensive Google Galaxy Nexus phone with ICS on it to do it. But future is bright! Check out the video demo here:
通过发布适用于 Android 手机的Google Chrome 远程调试和平板电脑调试移动网络应用程序不再痛苦。您需要一部带有 ICS 的昂贵的 Google Galaxy Nexus 手机才能做到这一点。但未来可期!在此处查看视频演示:
weinre is Web Inspector Remote. Pronounced like the word "winery". Or maybe like the word "weiner". Who knows, really.
weinre 是 Web Inspector Remote。发音像“酒厂”这个词。或者可能像“weiner”这个词。谁知道呢,真的。
回答by Kenny Grant
For those coming to this question from Google, there is now a Web Inspector available in iOS Safari(scroll down to "Safari on iOS").
对于那些从 Google 提出这个问题的人,现在iOS Safari 中提供了一个Web Inspector(向下滚动到“iOS 上的 Safari”)。
回答by Jesse
Have you tried Firebug Lite?
你试过Firebug Lite吗?
I haven't used it on the iPad, but I don't see why it wouldn't work.
我没有在 iPad 上使用过它,但我不明白为什么它不起作用。
I'd probably set a conditional include based on if a query param is set - for instance (php)
我可能会根据是否设置查询参数来设置条件包含 - 例如(php)
<?php if(isset($_GET['debug'])): ?>
<script type="text/javascript" src="firebuglite.js"></script>
<?php endif; ?>
回答by acejordan
Try iDebug. You can direct download it from AppStore onto your iPad. Here's the AppStore Link.
尝试iDebug。你可以直接从 AppStore 下载到你的 iPad 上。这是 AppStore 链接。
回答by daerin
回答by Gus T Butt
I have recently written a tool for showing console logs in a movable/resizable "window" (actually a div). It provides similar functionality to Firebug's console but you can see it over your page on a tablet. Tablet/Smartphone/Phablet Debug Console
我最近编写了一个工具,用于在可移动/可调整大小的“窗口”(实际上是一个 div)中显示控制台日志。它提供与 Firebug 控制台类似的功能,但您可以在平板电脑上的页面上看到它。平板电脑/智能手机/Phablet 调试控制台
回答by retrovertigo
You can also use Firefox's built in WebIDE with Valence
您还可以将 Firefox 内置的 WebIDE 与 Valence 一起使用
Plugin your device > in Firefox click on the spanner icon > find WebIDE > under "OTHER" click on "Safari, Firefox, and other WebViews on iOS"
插入您的设备 > 在 Firefox 中单击扳手图标 > 找到 WebIDE > 在“其他”下单击“Safari、Firefox 和 iOS 上的其他 WebView”
[2] https://hacks.mozilla.org/2014/06/webide-lands-in-nightly/
[2] https://hacks.mozilla.org/2014/06/webide-lands-in-nightly/
回答by John Washam
There is actually a way to debug a website in Safari on iOS using Firefox WebIDEon a Windows machine. I wrote an answer at https://stackoverflow.com/a/35714835/306179further describing this solution, as it was not necessarily straightforward to set up and use. It does not provide all the Developer Tools you would expect from, for instance, Chrome's DevTools suite, but it at least gives the Console, Inspector, and Debugger.
实际上有一种方法可以在 Windows 机器上使用Firefox WebIDE在iOS 上的 Safari 中调试网站。我在https://stackoverflow.com/a/35714835/306179 上写了一个答案,进一步描述了这个解决方案,因为它的设置和使用不一定直接。它没有提供您期望的所有开发者工具,例如 Chrome 的 DevTools 套件,但它至少提供了控制台、检查器和调试器。
回答by maracuja-juice
First you must ensure that you have the Web Inspector enabled ( "Settings > Safari > Advanced" and turn on "Web Inspector".)
首先,您必须确保启用了 Web Inspector(“设置 > Safari > 高级”并打开“Web Inspector”。)
Then connect your iPad to your Mac via an USB cable. After that I can choose in the "Develop" Menu of Safari to debug the website displayed on my iPad/iPhone.
然后通过 USB 数据线将 iPad 连接到 Mac。之后,我可以在 Safari 的“开发”菜单中选择调试显示在我的 iPad/iPhone 上的网站。
Source of images and original information: https://webdesign.tutsplus.com/articles/quick-tip-using-web-inspector-to-debug-mobile-safari--webdesign-8787
图片和原始信息来源:https: //webdesign.tutsplus.com/articles/quick-tip-using-web-inspector-to-debug-mobile-safari--webdesign-8787