我如何找到/分析“现在”正在执行的 JavaScript?使用 Firebug 还是其他方式?
我正在研究此页面: http://www.fxstreet.com/rates-charts/ currency-rates/ 由 JavaScript 使用来自服务器的新数据不断更新。很明显,页面中不断执行一些 JavaScript 函数。因此,我打开 Firebug,但没有看到任何“分析器”类型的输出,该输出会不断添加有关执行脚本的新信息。 “脚本”选项卡仅显示 46 条不太清晰的记录,没有时间戳,也没有任何迹象表明有持续的新 JavaScript 活动需要分析。
我做错了什么?如何了解页面上的 JavaScript 活动?
I am studying this page: http://www.fxstreet.com/rates-charts/currency-rates/ which is continually updated by JavaScript with new data from the server. So clearly there is some JavaScript function continually executing in the page. So I opened Firebug and I don't see any "profiler" type output that would continually add new info about executing scripts. The "script" tab only shows 46 not very clear records, without timestamps and without any indication that there is continual new JavaScript activity to profile.
What am I doing wrong? How do I go about groking the JavaScript activity on a page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 Firebug 的
Console
选项卡中,Clear
和Persist
旁边有一个Profile
按钮,它可以执行您的操作正在尝试做。它不是实时的,但您可以让它运行一段时间,然后分析结果,这应该会告诉您您正在寻找什么。In the
Console
tab of Firebug there is aProfile
button next toClear
andPersist
, which does what you're trying to do. It's not real-time but you can let it run for a certain time period and analyse the results afterwards which should show you what you're looking for.您可以执行以下三件事之一:
如果您要查找的是服务器请求/响应信息,则需要查看 firebug 的“Net”选项卡
You can do one of three things
If it is server request/response information you are looking for you want to look at the "Net" tab of firebug
在 firebug 或 chrome 开发工具中,选择 js 文件 cometd-1.1.2-teletrader.js。到达那里后,您可以在第 167 行设置断点,或者:
您也可以在第 171 行设置断点:
一旦您进入代码,您可以看到返回的对象,其中包含更新网格的数据。您可以进入 _longpoolComplete 并查看数据结构:
0: Object
频道:“/teletrader/symbols/3212198”
数据:对象
变化:“0.0124”
变化百分比:“0.1848”
日期时间:“2011 年 11 月 11 日 02:19:20”
最后:“6.6964”
符号 ID:3212198
1:对象
频道:“/teletrader/symbols/3212160”
数据:对象
更改:“-0.2725”
变化百分比:“-0.2202”
日期时间:“2011 年 11 月 11 日 02:19:21”
最后:“123.4650”
符号ID:3212160
等
In firebug, or chrome dev tools, select the js file cometd-1.1.2-teletrader.js. Once there, you can set a breakpoint at line 167 or :
you can also put a breakpoint at line 171 :
once you break into the code you can see the objects being returned which contain the data which update the grid. you can step into _longpoolComplete and see the data structure :
0: Object
channel: "/teletrader/symbols/3212198"
data: Object
change: "0.0124"
changePercent: "0.1848"
dateTime: "11.11.2011 02:19:20"
last: "6.6964"
symbolId: 3212198
1: Object
channel: "/teletrader/symbols/3212160"
data: Object
change: "-0.2725"
changePercent: "-0.2202"
dateTime: "11.11.2011 02:19:21"
last: "123.4650"
symbolId: 3212160
etc.