ouibounce icon indicating copy to clipboard operation
ouibounce copied to clipboard

IE8 compatibility

Open carlsednaoui opened this issue 11 years ago • 11 comments

As reported in #30, IE8 shows Object doesn't support property or method 'addEventListener'

carlsednaoui avatar May 12 '14 00:05 carlsednaoui

Nice :+1:

9mm avatar May 12 '14 00:05 9mm

Maybe something like this would help: https://github.com/WebReflection/ie8

jescalan avatar May 12 '14 14:05 jescalan

@9mm, does the code in https://github.com/carlsednaoui/ouibounce/compare/ie8 fix the ie8 bug? I'll find a way to test locally in the coming days.

carlsednaoui avatar May 13 '14 02:05 carlsednaoui

Sorry for delay, i'll check it out today.

9mm avatar May 14 '14 12:05 9mm

When I used the code from there (minified version) I got

Object doesn't support property or method 'reduce'

9mm avatar May 15 '14 02:05 9mm

Oh yeah IE8 doesnt support array.reduce haha. You probably just want to use an es5 shim with this library like this one: https://github.com/es-shims/es5-shim

Unless you want to worry about legacy js engines @carlsednaoui I might add a note that you'll need an es5 shim if you're running on ie8 or earlier to the readme?

jescalan avatar May 15 '14 03:05 jescalan

Thanks for the review @9mm.

Good call @jenius, I really don't want to deal with legacy stuff. Will add the es5-shims to the README.

carlsednaoui avatar May 15 '14 14:05 carlsednaoui

I'm currently using v0.0.9 so this issue may be different in v0.0.10 however the above listed fix is actually insufficient and just moves the problem to Line 28 because IE7+8 do not understand addEventListener. I was able to fix the issue by adding in another shim (https://github.com/jwmcpeak/EventShim) on top of the es5-shim mentioned above. Obviously considering the unfortunately high amount of IE8 users still in the wild this is less than ideal when a solution like the one shown here: http://stackoverflow.com/questions/9769868/addeventlistener-not-working-in-ie8 seems pretty straight forward. I may attempt to construct a fix but I am currently pressed for time and figured at least bringing it up would be better than letting someone else suffer with it.

A screenshot showing the bug: http://i.imgur.com/6cXUI3D.png

nathanielban avatar Oct 08 '14 15:10 nathanielban

Cool, looks like potentially adding the event shim to the caveats as well might help. As these shims continue rolling in, it might be worth it for us to add a new build file called shims or something that rolls them all into one place, but that the user can choose to include or not at their own discretion.

jescalan avatar Oct 08 '14 15:10 jescalan

Re-opening. @jenius wanna pair on this when I'm back Stateside? :hamburger:

carlsednaoui avatar Oct 08 '14 15:10 carlsednaoui

Sure, just let me know!

jescalan avatar Oct 08 '14 16:10 jescalan