HTC Android 设备和 adb logcat 上的 Javascript console.log() [英] Javascript console.log() on HTC Android devices and adb logcat

查看:48
本文介绍了HTC Android 设备和 adb logcat 上的 Javascript console.log()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用 HTML 开发应用程序,该应用程序从 Javascript 调用 console.log() 以在开发过程中为我提供有关网页代码中发生的情况的日志.

I am developing the application in HTML which is calling the console.log() from Javascript to provide me logs during the development about what happens in the web page code.

不幸的是,当我使用 adb logcat 命令检查日志时,我可以看到所有其他应用程序的输出,但看不到我的 JavaScript 代码的输出.我什至可以从 Web 浏览器看到页面已加载的日志,但看不到我在 Web 浏览器中执行的 JavaScript 代码的 console.log() 输出.

Unfortunately when I use the adb logcat command to check logs I can see output from all other applications, but not the output from my JavaScript code. I can see even the log from web browser that the page is loaded, but not console.log() output from my JavaScript code executed in the web browser.

根据本页(http://developer.android.com/guide/webapps/debugging.html) 它应该可以工作.

According to information on this page (http://developer.android.com/guide/webapps/debugging.html) it should work.

我正在 HTC WildFireHTC Desire HD 上进行测试.

I am testing on HTC WildFire and HTC Desire HD.

6 个月后编辑

在使用不同设备(电话、电视、机顶盒、WebViews、UIWebViews...)一段时间后,我的建议是从 JavaScript 进行远程日志记录,而不是依赖 strong>console.log() 或其他方法 - 查看图像加载的好技巧 此处.

After some time and experience with different devices (phones, TVs, set top boxes, WebViews, UIWebViews...) my advice is to do the remote logging from JavaScript and not relying on the console.log() or other methods - see the nice trick with the image loading here.

不要错过演示这里希望这可以帮助!斯坦

Do not miss the presentation here Hope this helps! STeN

推荐答案

在 Android 2.3.3 的默认浏览器中(大概从那时起),您可以简单地使用内置的 javascript 控制台:

In the default browser on Android 2.3.3 (and presumably from then on) you can simply use the built in javascript console:

  • 打开浏览器
  • 转到您的网页
  • 在地址栏中输入about:debug并回车
  • 如果您进入浏览器应用的设置,您会看到一个调试选项部分
  • 如果尚未启用,请勾选显示 JavaScript 控制台"
  • 刷新您的网页

在顶部,您会看到一个标有JavaScript 控制台"的栏.

At the top, you'll see a bar labeled "JavaScript Console".

这篇关于HTC Android 设备和 adb logcat 上的 Javascript console.log()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆