简体   繁体   中英

Recover javascript logs and errors on Internet Explorer without F12 tool

The main idea is to run a random page on Internet Explorer and get javascript errors and logs.

Is there a way to recover javascript console logs and execution error from a random web page without accessing the F12 tool on Internet Explorer?


I found that with Chrome based browser, you can get it on your AppData file log by adding --enable-logging --v=1 args when launching.

Any solution with any language are welcome.

Thank you for your answer.

NOTE :

random page on Internet Explorer means that I do not have the access on the source code.

Basic solution to this would be: 1. Use Exception Handling to catch the errors. 2. Log errors in a Global Array 3. Log the errors in a file using Blob and URL.createObjectURL. All recent browsers support this.

Have you considered using a Bookmarklet that:

  1. Overrides window.console.log and window.console.error (to intercept messages)
  2. Logs incoming messages somewhere using createObjectURL?

Or you could use something like firebuglite and auto-enable it like this:

<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js">
{
    overrideConsole: false,
    startInNewWindow: true,
    startOpened: true,
    enableTrace: true
}
</script>

More instructions are here: http://getfirebug.com/firebuglite

If the F12 tool is not of your interest, then what about the Event Viewer? Open Event Viewer from Control Panel -> System and Security -> Administrative Tools -> Event Viewer.‌ Then select the log Applications and Services Logs\\Internet Explorer.

By default no events are being logged for Internet Explorer, to enable them create a new DWORD registry value named Feature_Enable_Compat_Logging under the following registry key:

HKCU\SOFTWARE\Microsoft\Windows\Internet Explorer\Main \FeatureControl

and set the registry value to 1.

Check the logs you get to see if it's what you're looking for.

One idea would be to write a browser extension which listens for window.onerror and writes to a file. Definitely not as elegant as the Chrome solution, but it would work fairly well.

Using local proxy might be a good one-time solution. Charles web debugging proxy app has nice UI and it allows to replace any response with local resource.

So basically you'll need:

  1. Download one any of the js files used on target page
  2. add any code you wish to saved version
  3. set up Charles to serve you your local version instead of remote one

You might try Fiddler. It's got its own logging and has amazing inspection power. It won't capture IE specific errors, since it's at a different layer, but it will definitely get you any code that's coming over the wire.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM