Daugilas / lazyYT

A jQuery plugin to lazy load those dang Youtube iframe videos.
Other
56 stars 14 forks source link

Doesn't work in IE8 #15

Open BB-000 opened 8 years ago

BB-000 commented 8 years ago
SCRIPT5007: Unable to get property 'path' of undefined or null reference 
lazyYT.js, line 221 character 7

:(

IE8 doesn't get any of the Youtube info ( thumbnail / title ) and gets stuck on the blank ' loading... ' screen. This screen can be clicked which then inserts the iframe...

Can be replicated on the demo page [http://works.daugilas.com/lazyYT/demo/fluid.html]

Any workarounds for this?

BB-000 commented 8 years ago

I found a workaround,

The problem was this function, the data parameter was always 'undefined' in < IE9

function getOnloadDataParam(data, key) { ... }

So I just added the below as the first if statement. Returning nothing seems to work fine, as the rest of the loadBackgroundImage function sorts it out. ( adding any number under 700 makes the background black for some reason? )

if (typeof data == 'undefined') {
        return;
      } else if ....

So this works, let me know if there's a better way of doing this though :]

Also IE8 *edit( IE9 ) couldn't fetch the video title, so I just set display_title to false in < IE10 ( I assume it is something to do with the Youtube API not working in these retro browsers? )