我在做一个和拉斐尔有关的项目。事实证明,它在Android上不起作用。iPhone上是这样的。

我该怎么调试Android浏览器上的东西呢?它是WebKit,所以如果我知道版本,在完整版本的WebKit上调试它会产生相同的结果吗?


当前回答

看一看jsHybugger。它将允许你远程调试你的js代码:

Android混合应用(webview, phonegap, worklight) Web页面运行在默认的android浏览器(不是Chrome,它支持ADB扩展没有这个工具)

这是如何工作的(在项目网站上有更多的细节和替代方案,这是我发现的最好的方法)。

Install the jsHybugger APK on your device Enable USB debugging on you device. Plug the Android device into your desktop computer via USB Run the app on the Android device ('jsHybugger') Enter the target URL and page in the app. Press Start Service and finally Open Browser You'll be presented with a list of installed browsers, choose one. The browser launches. Back on your desktop computer open Chrome to chrome://inspect/ An inspectors window will appear with the chrome debugging tools linked to the page on the Android device. debug away!

同样,在Android上使用Chrome使用ADB扩展而不使用jsHybugger。我想这个问题的公认答案已经描述过了。

其他回答

http://jsconsole.com (http://jsconsole.com/remote-debugging.html)提供了一种很好的方式,您可以使用它来访问您的网页内容。

你可以尝试YConsole一个js嵌入式控制台。它重量轻,使用简单。

捕获日志和错误。 对象编辑器。

使用方法:

<script type="text/javascript" src="js/YConsole-compiled.js"></script>
<script type="text/javascript" >YConsole.show();</script>

试试“vconsole”,也许能帮到你

没有人提到liriliri/eruda,它为移动网站/应用程序添加了自己的调试工具

将此添加到您的页面:

<script src="//cdn.jsdelivr.net/npm/eruda"></script>
<script>eruda.init();</script>

将在打开控制台的页面中添加一个浮动图标。

我用Weinre,阿帕奇科多瓦的一部分。

使用Weinre,我可以在桌面浏览器中获得谷歌Chrome的调试控制台,并可以将Android连接到该调试控制台,并调试HTML和CSS。我可以在控制台中执行Javascript命令,这些命令会影响Android浏览器中的Web页面。来自Android的日志消息出现在桌面调试控制台中。

然而,我认为这是不可能查看或逐步通过实际的Javascript代码。所以我把Weinre和日志信息结合起来。

(我对JConsole了解不多,但在我看来,用JConsole检查HTML和CSS是不可能的,只有Javascript命令和日志记录(?))