Forum Moderators: open

Message Too Old, No Replies

JS not working properly in IE and Edge browsers

         

abrodski

2:04 am on Jul 25, 2019 (gmt 0)

10+ Year Member



Hello!
I've got a small JS-based music player on my homepage in its upper-left corner (just above the logo). And it works fine in all browsers, except IE and Edge. In those it shows NaN where the song's total time is supposed to be after the page loads. I'll attach a printscreen, so you can see it clearly. But if you try to load my site in FF or Chrome, then it's fine!

[edited by: not2easy at 2:54 am (utc) on Jul 25, 2019]
[edit reason] Please read our ToS [/edit]

NickMNS

2:40 am on Jul 25, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Internet Explorer and Edge to a lesser extent have compatibility issues in terms of JS, there are many commands and functions that don't play nice and thus need to be polyfilled (ie: extra code that works in IE/Edge needs to be added to achieve the task of the command or function the is not compatible).

You need to figure out what part of the code is causing the problem and then find a suitable polyfill. Note many polyfill are already written and freely available.

tangor

6:25 am on Jul 25, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Might explore using Canvas ... bit more learning curve, but is supported by new browsers and most phone applications.

Dimitri

10:12 am on Jul 25, 2019 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



Just for the info NaN = Not-A-Number

abrodski

8:45 pm on Jul 27, 2019 (gmt 0)

10+ Year Member



Here's the solution:
Solved that NaN issue in a music player! It was due to a gzip compression on the server. Had to cancel it just for mp3 files by putting this code in root's .htaccess file

<IfModule mod_headers.c>
<FilesMatch "\.mp3$">
RewriteRule ^(.*)$ $1 [NS,E=no-gzip:1,E=dont-vary:1]
</FilesMatch>
</IfModule>

This thread can be closed now...

tangor

8:58 am on Jul 29, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Actually ... that is a happy ending. :)

Perseverance is the best of all traits. Kudos!

docluv

8:01 pm on Oct 1, 2019 (gmt 0)

10+ Year Member



That would be an issue since mp3, images, mp4, etc are all already compressed by design.
Not sure why you would get a NaN error with that though. Glad you found a solution.

Also, NickMNS, the editor of the JavaScript specification works for the Microsoft browser team and owns Chakra. It has for years been the first engine to get support for just about everything new to JavaScript because of this.

Of course now Chakra will more or less be a nodejs engine going forward as the new Edge has moved to V8.

lucy24

8:30 pm on Oct 1, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



{insert-noun-here} not working properly in IE and Edge
Plus ça change, ça plus you-know-the-rest.