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

Error in IE9 #1

Closed
cheesegrits opened this issue Dec 4, 2011 · 5 comments
Closed

Error in IE9 #1

cheesegrits opened this issue Dec 4, 2011 · 5 comments
Assignees

Comments

@cheesegrits
Copy link

Loading your demo page in IE9, I get:

SCRIPT5009: 'console' is undefined
consolelog.js, line 2 character 1

-- hugh

@ghost ghost assigned patik Dec 4, 2011
@patik
Copy link
Owner

patik commented Dec 4, 2011

That's strange — if console was undefined, then the if statement should have stopped (without error) at the second argument. Where are you seeing that error, in the console or along the bottom of the browser window?

Can you try running the demo here: http://patik.com/demos/consolelog/

Also, check whether you're running in Compatibility View. Press F12 to bring up the developer toolbar, and along the top it should say "Browser Mode: IE9" and "Document Engine: IE9".

@cheesegrits
Copy link
Author

Hmmm, Bizarre.

Although your site was in IE9 mode, I had another page open in IE8 mode, which is why I was on your site, as I couldn't get console.log() to work in some JS debugging I was doing on that site. As long as I had that other devtools open, your site would break on the 'if' (which is line 2).

As soon as I closed the other copy of devtools, the problem went away.

I know it shouldn't matter, but maybe you could make that "typeof(console) !== 'undefined'" just to be on the safe side?

-- hugh

@patik
Copy link
Owner

patik commented Dec 5, 2011

Yes, the dev tools in IE aren't great and can sometimes "bleed" across tabs or even misrepresent what mode you're in. It's always best to do a full refresh after changing the browser mode (and leave the dev tools open).

Your recommendation is a sound one, though to be correct I will instead check that typeof is either object or function (it'll be object, but might as well be safe). I'll put it in the next version.

@patik patik closed this as completed Dec 5, 2011
@cheesegrits
Copy link
Author

Cool, thanks for the fast responses, and the "fix". I'm about to go
and include your wrapper in my project.

-- hugh

On Mon, Dec 5, 2011 at 5:37 PM, Craig Patik
reply@reply.github.com
wrote:

Yes, the dev tools in IE aren't great and can sometimes "bleed" across tabs or even misrepresent what mode you're in. It's always best to do a full refresh after changing the browser mode (and leave the dev tools open).

Your recommendation is a sound one, though to be correct I will instead check that typeof is either object or function (it'll be object, but might as well be safe). I'll put it in the next version.


Reply to this email directly or view it on GitHub:
#1 (comment)

@jslaybaugh
Copy link

Bump. Just ran into a strange instance of this in IE9 as well. I'm using a tool that automatically minifies my code in production (https://github.com/andrewdavey/cassette) and it ends up generating the same first line as your minified version in the master branch but for some reason it was failing when the dev tools weren't loaded (it worked fine when I was running the unminified version). Anyway, changed line 2 from if (Function.prototype.bind && console && typeof console.log == "object") to if (Function.prototype.bind && typeof console !== 'undefined' && typeof console.log == "object") and everything works like a champ in IE9 now.

I see this was closed 6 months ago and the last commit was 12 months ago, so I assume this just got lost somewhere along the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants