Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use isUndefined on console object in IE8, will throw javascript error #280

Closed

Conversation

butchmarshall
Copy link
Contributor

This code crashes IE8 - need to explicitly check typeof

@tivie
Copy link
Member

tivie commented Jul 22, 2016

Really? IE8 complains? Why?

@butchmarshall
Copy link
Contributor Author

butchmarshall commented Jul 22, 2016

Basically, IE8 isn't a good browser.

<html>

<head>
    <script type="text/javascript">
        function isUndefined(a) {
            return typeof(a) === "undefined"
        }
        if (isUndefined(console)) {
            alert('yes!');
        }
        alert('no');
    </script>
</head>
<body>

</body>

</html>

Run that in IE8. An undefined variable will halt script execution and you'll never get "no".

The key is to never open the "developer tools" in IE8. If you do, it will work until you close and reopen the browser.

image

@tivie tivie self-assigned this Aug 19, 2016
@tivie tivie added the bug label Aug 19, 2016
@tivie tivie added this to the Improve IE8 compatibility milestone Aug 19, 2016
@tivie
Copy link
Member

tivie commented Aug 19, 2016

this is mental... But does this only happen with console object? or with any other variable?

@tivie tivie closed this in 561dc5f Jan 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants