Processing
 

Including ECMA 5 script in IE8

08/09/2016 05:48#1

Joined at: 5 months ago

Post: 1

Thank: 0

Thanked: 0

Currently, I am using hls.js in my code to play hls streams. The original code is written in ECMA version 6 and then transpiled into ECMA 5 and places in the dist folder (above link). It works perfectly elsewhere.

I don't plan to use any if the functions from the library. I simply want to include it. Rendering it on IE8 gives errors about the syntax.

Is it possible to transpile the js file into a version compatible with IE8 or I should simply find a way to not include the file at all?

EDIT

Following this I tried doing the following:

<html> <h1> IE test new </h1>  <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-sham.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.34.2/es6-shim.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.34.2/es6-sham.min.js"></script> <script src="https://wzrd.in/standalone/es7-shim@latest"></script>  <script src="https://cdn.jsdelivr.net/hls.js/latest/hls.js"></script>  </html> 

However, it still gives the following error on IE8:

Expected identifier hls.js, line 320 character 31

EDIT 2

I used the following .babelrc file to transpile it to es3 file and fix some other errors.

{   "presets": ["es3"],   "plugins": ["transform-es3-property-literals", "transform-es3-member-expression-literals"] } 

However, now I face the following error on IE8.

  Object doesn't support this property or method  hls.js, line 1063 character 17 

The specific error is on the line Object.defineProperty. It seems IE 8 does not support the defineProperty method. Is there a way to fix this.`?

08/09/2016 10:17Top#2

Xotic750

Member

Joined at: 10 months ago

Post: 10

Thank: 0

Thanked: 0

It looks like old IE has a problem with the property being named default and treats it as a reserved word when used on an object. So to fix the issue you would need to open a ticket with hls and ask them to change it to something different or use it quoted exp['default']

http://jonathonhill.net/2009-11-24/javascript-reserved-words-trigger-expected-identifier-error-on-ie/

But they do state.

Compatibility

hls.js is compatible with browsers supporting MSE with 'video/MP4' inputs. As of today, it is supported on:

Chrome for Android

34+ Chrome for Desktop

34+ Firefox for Android 41+

Firefox for Desktop 42+

IE11+ for Windows 8.1

Safari for Mac 8+ (beta)

I don't know if any transpiler can transpile this into something that is not a problem for old IE. But maybe.

Babel 6.0.20 Modules feature not work in IE8

Similar articles

IE9 dosen't support my Button Tag

5 months ago - Reply: 0 - Views: 18

SSRS 2016 Web protal in IE8

5 months ago - Reply: 0 - Views: 17

how to handle @keyframes not supported by ie9?

5 months ago - Reply: 0 - Views: 5

Detect Windows XP in Firefox with JS

6 months ago - Reply: 1 - Views: 47

IE8 Not showing divs with floats

6 months ago - Reply: 2 - Views: 131

Including ECMA 5 script in IE8

6 months ago - Reply: 1 - Views: 98

XDomainRequest does not work in ie8 & ie9

6 months ago - Reply: 0 - Views: 11

How to minify angular.js?

6 months ago - Reply: 1 - Views: 32

VBA and IE8 - scrape text buried in table

6 months ago - Reply: 1 - Views: 39

Detect http satus IE10

6 months ago - Reply: 0 - Views: 8

how to compress angular.js?

6 months ago - Reply: 0 - Views: 4

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re