I'm building a widget which would be used in different eCommerce sites.
As i'm using underscorejs library, i need to see if underscorejs exists in the parent site and if so what version.
If underscore is already defined in the site and if the version matches with the one i used. I would inturn use their own defined underscore and not make a CDN call to load underscorejs for my widget.
You can easily check that with the following
if (!window._ || window._.VERSION !== '1.7.0') {
// Load underscore from CDN
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With