Welcome to WebmasterWorld Guest from 3.81.29.226

Forum Moderators: open

JS not working properly in IE and Edge browsers

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

Junior Member

10+ Year Member

joined:July 14, 2009
posts:139
votes: 0


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]

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

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Apr 1, 2016
posts:2738
votes: 837


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.
6:25 am on July 25, 2019 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 29, 2005
posts:10563
votes: 1123


Might explore using Canvas ... bit more learning curve, but is supported by new browsers and most phone applications.
10:12 am on July 25, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Nov 13, 2016
posts:1194
votes: 288


Just for the info NaN = Not-A-Number
8:45 pm on July 27, 2019 (gmt 0)

Junior Member

10+ Year Member

joined:July 14, 2009
posts:139
votes: 0


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...
8:58 am on July 29, 2019 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 29, 2005
posts:10563
votes: 1123


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

Perseverance is the best of all traits. Kudos!
8:01 pm on Oct 1, 2019 (gmt 0)

New User from US 

10+ Year Member

joined:May 31, 2004
posts:31
votes: 3


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.
8:30 pm on Oct 1, 2019 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15934
votes: 887


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