Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
IE8 javascript hacks
//http://stackoverflow.com/questions/1695376/msie-and-addeventlistener-problem-in-javascript
function addEventListener(el, eventName, eventHandler) {
if (el.addEventListener){
el.addEventListener(eventName, eventHandler, false);
}
else if (el.attachEvent){
//ie8 does not support addEventListener
el.attachEvent('on'+eventName, eventHandler);
}
}
//IE8 does not support Date.now
if( !Date.now) {
Date.now = function() {return new Date().getTime();};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.