Skip to content Skip to sidebar Skip to footer

Form Works In Internet Explorer Only When I Hit F12 To Bring Up Console

My form works only when I hit console in Internet Explorer. Works in all other browsers fine. Here is the HTML: Why is it that when I bring up console everything works fine in IE?

Solution 1:

As I said in comments, I suspect you have an uncommented call to console.log somewhere.

This is a frequent problem on IE as the console object isn't available when the developer tools aren't open.

The common workaround is to build a dummy object to replace it when it's not available :

if (!window.console) {
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
    window.console = {};
    for (var i = 0; i < names.length; ++i) {
        window.console[names[i]] = function() {};
    }
}

Solution 2:

Internet explorer exposes the console object only when the developer tools are active (e.g., pressing F12).

If the developers tools are hidden, then calling console.log will throw an exception, hence, the javascript code will break.

Post a Comment for "Form Works In Internet Explorer Only When I Hit F12 To Bring Up Console"