36

I want to debug (examine DOM, use the interactive JS console, etc) part of a web application that is inside a modal dialog that was created by showModalDialog().

I can't find a way to use the standard IE-8 developer tools for this; The dialog doesn't have a toolbar and the usual shortcut (F12) doesn't work.


Another SO question (I unfortunately have lost the link to) suggested that the only solution is to (perhaps temporarily) replace showModalDialog() with an old-fashioned window.open(). If this is the case, is there a straightfoward way to do it?

Caveats:

  • The app cares about passing dialogArguments and the return value of showModalDialog
  • I can't use other browsers, FF+Firebug, etc.
0

4 Answers 4

64

F12 works to bring up the developer tools if you turn the address bar on.

Go Tools / Internet options / Security / (pick the right zone for your site) / Custom Level Under "Miscellaneous" Under "Allow websites to open windows without address or status bars", choose "Disable".

Source: https://stackoverflow.com/a/10984858/79835

3
  • I've adjusted this setting for my site's zone (and all others, in fact), but the showModalDialog still pops up a dialog with no address bar. I'm using IE 8.0.7601.
    – bentsai
    Feb 23, 2015 at 15:43
  • 1
    Is there any reason this might show a status bar but not allow debug? I'm using IE 11.
    – Chris
    Feb 16, 2017 at 20:37
  • Also saw the problem with the address bar but no Dev Tools showing under IE 11. This worked to force the modal dialog to show in a normal tab.
    – df778899
    Jun 15, 2018 at 10:45
7

i do it by creating an error in the js code, which then brings up the error window asking if you want to debug the script.

one way to do that would be to call a non-existent method somewhere in the code.

e.g. blabla();

2
  • 1
    Script debugging is turned off by default on IE. I had to enable it on the Advanced Internet Options.
    – hugomg
    Feb 8, 2011 at 20:21
  • My company's group policy prevents me from changing the security options, and is set to allow windows without address or status bars (I like how they lock down the settings in a LESS secure manner than I want them!). So, this was the only way I was able to get the dev tools to open.
    – Elezar
    Mar 26, 2015 at 4:30
3

You can now put the word debugger without quotes in your javascript.

IE and Chrome should both break on it as if you had set a breakpoint on it. Make sure its on a line by itself. Press F12 to open the browser debugger and then refresh your page or trigger the event to run your javascript and the debugger should automatically display the code with the breakpoint set.

2
  • in IE, you might need to click on the Script tab of the debugger and click the 'Start debugging' button first. At least you do on IE9.
    – Bill
    Apr 26, 2013 at 22:49
  • Start debugging always wants to reload the page, that's annoying. Aug 26, 2015 at 14:07
2

What I do when i'm debugging modal windows are two things.

  • You can include in your js code the instruction debugger; that will stop the js execution as if you had put a breakpoint.
  • You can also open the ie developer tools before opening the modal window and, once it's open, you can review the generated code in the script tab, adding breakpoints, pausing execution,... everything you need.

Hope it helps!

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.