简体   繁体   English

调试网页(Firebug,IE F12工具)

[英]debugging web pages (Firebug, IE F12 tools)

I would like to know how I can use a debugger (Firebug or IE's F12 tools) to trace step by step the code I am receiving from a webpage once I POST. 我想知道如何使用调试器(Firebug或IE的F12工具)一步一步地跟踪我发布后从网页接收的代码。

My problem is that I fill out a form, and after POSTing the form, I get a response that has some redirects and other stuff apparently happening there. 我的问题是我填写了一个表单,并且在将表单过帐后,我得到的响应中包含一些重定向和其他显然发生的事情。 I would like to know how can I simply halt execution upon POST and go step by step on the javascript code that is happening, and see exactly how the redirects are formed. 我想知道如何简单地在POST上停止执行,并逐步了解正在发生的javascript代码,并确切了解重定向的形成方式。

The thing is I cannot place any breakpoints because I don't have the page's response before I even POST it... 问题是我无法放置任何断点,因为我什至在发布页面之前都没有页面的响应...

I hope I was clear enough about my issue. 我希望我对我的问题足够清楚。

Thanks in advance. 提前致谢。

You can add a debugger; 您可以添加debugger; statement as the first line of your JavaScript code, which launches a debugger if one is registered. 语句作为JavaScript代码的第一行,如果已注册则启动调试器。

Therefore, all you need to do is ensure Firebug is launched before the page is loaded, and the JavaScript execution should be halted to allow you to step through the program. 因此,您要做的就是确保在加载页面之前启动Firebug,并且应该暂停JavaScript执行,以允许您逐步执行程序。

Another (hacky) way you could do this is to place an alert() or similar as the first line; 您可以执行的另一种(hacky)方法是将alert()或类似内容放置在第一行; an alert() blocks the program flow until the prompt is closed. alert()阻止程序流,直到关闭提示为止。 Without closing the alert, you could place a breakpoint on the next line of executable code after the alert() , then OK the alert, and then debug away. 在不关闭警报的情况下,您可以在alert()之后的下一行可执行代码中放置一个断点,然后OK ”警报,然后进行调试。

Assuming you have IE9 installed: 假设您已安装IE9:

  1. Press F12. 按F12。
  2. Click on the network tab 点击网络标签
  3. Click "Start capturing" 点击“开始捕获”
  4. Execute your script 执行你的脚本
  5. You will see all the responses and redirecs there. 您将在那里看到所有响应和重新发布。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何识别控制台/ firebug / IE9 F12是否发出HTTP GET请求? - How to identify if HTTP GET request is made by console/firebug/IE9 F12? 打字稿和Chrome调试器(F12工具) - Typescript and the Chrome Debugger (F12 Tools) IE10-F12工具可以用于对动态添加的JavaScript进行除胶吗? - Can the IE10 - F12 tools be used to degub JavaScript that is added dynamically? 了解IE11 F12 Developer工具中无法访问的断点 - Understanding unreachable breakpoints in IE11 F12 Developer tools IE11的F12开发人员工具缺乏使控制台保持导航的选项 - IE11's F12 developer tools lack option to keep console on navigation 右键单击和IE F12开发人员工具不适用于模式窗口 - Right-click and IE F12 Developer Tools aren't working on modal window IE11 中的间歇性 AJAX 文件上传失败 - F12 工具无限期地显示“Pending...” - Intermittent AJAX file upload failure in IE11 - F12 tools show "Pending..." indefinitely 如何使F12开发人员工具在模拟IE版本的JavaScript上下文中运行? - How to make F12 developer tools operate in the JavaScript context of emulated IE versions? 如果我在IE下按F12键,地图仅在我的网页上可见 - Map only visible on my web page if I press F12 key under IE IE9 F12开发人员工具 - “加载(事件)”和“页面加载完成”之间有什么区别? - IE9 F12 Developer Tools - What's the difference between “Load(event)” and “page has finished loading”?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM