admin管理员组

文章数量:1201647

I have a very complex website and I know that somewhere is an alert() with a description. Is there a way to set a breakpoint on the alert() call? The HTML is generated, so I cannot just grep for the message.

I have a very complex website and I know that somewhere is an alert() with a description. Is there a way to set a breakpoint on the alert() call? The HTML is generated, so I cannot just grep for the message.

Share Improve this question edited Jun 23, 2016 at 16:29 Sebastian Zartner 20.1k10 gold badges102 silver badges141 bronze badges asked Oct 21, 2014 at 13:49 Pan BydlakPan Bydlak 5676 silver badges13 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 28

You can use the console to replace the alert function:

window.alert = function() { debugger; };

Firebug's Script panel allows you to search for code throughout all your JavaScript sources.

So you can simply search for alert( or search for the message that the alert box shows and set a breakpoint on the line where it's called.

Another way is to use the Break On Next button ( ) to stop at the next JavaScript statement that gets executed. So, click the button and then do the action that causes the alert box to be displaced.
Note: This only works if there are no other event handlers called before the event showing the alert box.

本文标签: javascriptHow to set breakpoint in Firebug on alert()Stack Overflow