Vimeo player won't load on select sites

204 Views Asked by At

I have a strange problem — on some websites, if I load Vimeo's javascript player API, it's defined. On others, it's undefined.

On StackOverflow, you can open the javascript console and paste in:

jQuery.getScript('https://player.vimeo.com/api/player.js', function () {
    alert(window.Vimeo);   
});

And you'll get an alert with [object Object].

If you paste that exact same code in redbankgreen.com, for example, you get an alert with "undefined."

Am I missing something obvious? The same problem exists for inclusion via <script> but I'm using jQuery for easy replication.

1

There are 1 best solutions below

0
On

As it turns out, there are some some scripts defining a global module.exports object which Vimeo hooks into instead of defining a global Vimeo object.

So Vimeo was loaded, but in a module.exports object left behind by another script.