最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Is there a JavaScript function to make Google Chrome break into the debugger? - Stack Overflow

programmeradmin1浏览0评论

I am looking for something like Debugger.Launch() in .NET, which breaks into the debugger programmatically.

I am not looking for a cross browser way to do it, just Google Chrome is good enough.

I am looking for something like Debugger.Launch() in .NET, which breaks into the debugger programmatically.

I am not looking for a cross browser way to do it, just Google Chrome is good enough.

Share Improve this question edited Apr 7, 2015 at 12:34 Pierre Arnaud 10.5k13 gold badges82 silver badges112 bronze badges asked Feb 27, 2012 at 9:39 markmark 62.8k94 gold badges339 silver badges667 bronze badges 2
  • Possible duplicate of : stackoverflow.com/questions/66420/… – DhruvPathak Commented Feb 27, 2012 at 9:41
  • 2 It is similar, but I am looking for a programmatic way, so that the browser stops there automatically without any actions from me. The answer to that question talks about an interactive way, although there is a response which answers my question exactly. – mark Commented Feb 27, 2012 at 10:29
Add a comment  | 

1 Answer 1

Reset to default 24

Yes, you need to use:

debugger;

The script will break exactly at line where you put debugger keyword.

To view it, you will first need to open Tools -> Developer tools (or pressing F12) and then by selecting your file from Scripts tab.

发布评论

评论列表(0)

  1. 暂无评论