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

IE 10 Compatibility #17

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

IE 10 Compatibility #17

wants to merge 4 commits into from

Conversation

liquiddc
Copy link

These changes make dashing-js work with IE10

Dan Crawford added 4 commits January 29, 2014 23:52
logging to console in IE10 with no developer mode window open trashes page layout
Add Access-Control-Allow-Origin header setting to fix XHR problem
Don't log to console in IE as it trashes formatting if no Developer Tools window open
Force document mode to IE9 (not edge)
@arabold
Copy link
Contributor

arabold commented Feb 15, 2014

Thanks for this patch. I'll check it out, too. 2 comments though:

  • Is the Access-Control-Allow-Origin: * header really necessary for you? In my opinion the domain on which the client JS runs should always be the same as for the server itself. Why would we need cross-origin scripting?
  • Instead of commenting out console.log(...) I suggest to add a polyfill such as console-polyfill which can also be installed via bower. If we don't need a complete polyfill, a simple var console=console||{"log":function(){}}; should do the trick, too. The reason is that console.log actually is supported in IE10, but only if the console window is open.

@liquiddc
Copy link
Author

Thanks. Re the first point, I agree this needs tightening up, but * was the suggested fix that I found works in my environment. If there is a tighter way to specify this header, I will try it out.

Re the second point - creating a console object for IE in no-console mode is the way to go. I have no IE10 environment to test this in now, but adding the following line to application.coffee works in IE11:

console = console or {"log": () -> {}}

@arabold
Copy link
Contributor

arabold commented Mar 26, 2014

Just wanted to update you that this works perfectly on IE9, too.

@pjeby
Copy link

pjeby commented Apr 22, 2014

FYI, this line:

console = console or {"log": () -> {}}

Doesn't do what you think it does. It always disables logging, because it makes console into a local variable, which shadows the window.console. So the variable is always empty to start with, and then it's set to the dummy value.

You probably want:

window.console ?= log: ->

instead.

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

Successfully merging this pull request may close these issues.

3 participants