Skip to content

Ways to debug js in IE when the developer tool isn’t working

February 4, 2016

I spent a whole day trying to figure out how to get the developer tool work in IEv11 yesterday but couldn’t. All I wanted was to see the user-agent string from the browser session (I’ve logged the string to window.console). In the end I just gave up and dump the string to a local txt file on C:\ drive, here’s the simple code:

 var fso = new window.ActiveXObject("Scripting.FileSystemObject");
 var fh = fso.OpenTextFile("c:\\datadata.txt", 8, false, 0);
 fh.WriteLine(navigator.userAgent);
 fh.Close();

Just make sure you created an empty text file c:\datadata.txt before you run the code.

Alternatively you can write a simple html page that calls js methods to check the output:

<html>
    <head>
       
          function detectUserAgent() {
             document.write(navigator.userAgent);
          }
      
    </head>
   <body>
       
          detectUserAgent()
       
    </body>
  </html>

Happy debugging 🙂

From → Effective Java

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: