admin管理员组文章数量:1323348
What is a good way to debug a popup window in Chrome? I need to debug some code that is run when the window is opened and I was wondering if there was a better way to debug it than pressing f12 as soon as the window opens. I'm looking for something similar to using Visual Studio where you can open a window, set a breakpoint on some JS, then open the window back up and VS will break on that breakpoint without you having to do anything.
If it can be done some way on Firefox I'd switch to that, as long as I don't have to use IE.
What is a good way to debug a popup window in Chrome? I need to debug some code that is run when the window is opened and I was wondering if there was a better way to debug it than pressing f12 as soon as the window opens. I'm looking for something similar to using Visual Studio where you can open a window, set a breakpoint on some JS, then open the window back up and VS will break on that breakpoint without you having to do anything.
If it can be done some way on Firefox I'd switch to that, as long as I don't have to use IE.
Share Improve this question asked Nov 25, 2013 at 17:00 sheodoxsheodox 8351 gold badge10 silver badges17 bronze badges 10- Did you enter a debugger statement in the page you want to look at? – Mike Cheel Commented Nov 25, 2013 at 17:41
- Yes, but if the dev tools aren't open it won't break. Which brings me back to the same problem unfortunately. – sheodox Commented Nov 25, 2013 at 17:49
- What is preventing you from opening the devtools and then opening the page? I do this all the time. – Mike Cheel Commented Nov 25, 2013 at 18:16
- I need to debug some initialization code on a popup window, not just a normal page. – sheodox Commented Nov 25, 2013 at 18:29
- After putting the debugger statement in your code you should be able to go to the initial page BEFORE opening the popup, open the chrome debugger and then launch the popup which should then break on the debugger statement. – Mike Cheel Commented Nov 25, 2013 at 18:51
2 Answers
Reset to default 5Nowadays there's an option in the Chrome devtools settings. "Auto-open DevTools for popups".
Check that checkbox, then if you have devtools open on the parent window and that opens a popup or new tab devtools will automatically open in that window/tab.
Short Answer:
"Ctrl + click"
Long Answer:
I had the same problem. It seems that it's a bug in Google Chrome and there's nothing we can do about it until it is fixed in future versions. I found a way around it, though, which is not an actual solution but solved my problem.
1) Close the popup window.
2) Open it again using "Ctrl + click" instead of just clicking on the link to the popup window.
3) The window will be opened in a new normal tab.
4) Now you can press F12 and go to debug mode.
Hope this solves someone else's problem too.
本文标签: Debugging JavaScript in popup windows on ChromeStack Overflow
版权声明:本文标题:Debugging JavaScript in popup windows on Chrome - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742132329a2422219.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论