Question

Can I load jQuery in fondation from google CDN, I know of the:

 `<script>
document.write('<script src=' +
('__proto__' in {} ? 'js/vendor/zepto' : 'js/vendor/jquery') +
'.js><\/script>')
</script>`

and its loaded from the server that is hosting the side. Do I just include google CDN in the header and leave it like that or can I remove jquery from local directories(how to change the ternary operator, I mean in what way?)

Était-ce utile?

La solution

You can make it to load jQuery from Google CDN and Zepto from your server:

<script>
document.write('<script src=' +
('__proto__' in {} ? 'js/vendor/zepto' : '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min') +
'.js><\/script>')
</script>

You can also make it always load jQuery and completely ignore Zepto, to do this add:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

to your <head> section and remove document.write call.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top