Skip to content Skip to sidebar Skip to footer

Ie11 Javascript (error: Script445) "object Doesn't Support This Action"

I use a Javascript solution which loads the youtube player API asynchronously. The whole script is supposed to play the video when scrolled to its position. It works in all browser

Solution 1:

object doesn't support this action is error is coming in IE11 using window.dispatchEvent(new Event('resize')); we need to d handle the condition for ie11.

if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) {
                   var evt = document.createEvent('UIEvents');
                   evt.initUIEvent('resize', true, false, window, 0);
                   window.dispatchEvent(evt);
        } else {
                 window.dispatchEvent(newEvent('resize'));
        }

Solution 2:

There is a race condition in IE that is firing off your script loader callback before the entire script is evaluated. By using setTimeout(initYT, 0) you will allow the script to finish evaluating before firing your initialization function. Glad it worked!

Post a Comment for "Ie11 Javascript (error: Script445) "object Doesn't Support This Action""