Is it safe to reference google's JQuery library?

后端 未结 5 1134
故里飘歌
故里飘歌 2021-02-07 15:49

I have included a reference to Google\'s JQuery library in my markup:



        
相关标签:
5条回答
  • 2021-02-07 16:22

    Have the best of both worlds. Use theirs for fast, possibly pre-cached, delivery and in case their server goes down (more likely than them moving it) fallback to your own:

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
    <script type="text/javascript">
    if (typeof jQuery == 'undefined')
    {
        document.write(unescape("%3Cscript src='/path/to/your/jquery' type='text/javascript'%3E%3C/script%3E"));
    }
    </script>
    

    Taken from: Best way to use Google's hosted jQuery, but fall back to my hosted library on Google fail

    0 讨论(0)
  • 2021-02-07 16:33

    It is 100% safe to use Google's hosted jQuery file. In fact, it is actually faster because browsers can download multiple files at once from different servers. Also, if the user has visited a website that uses Google's jQuery before, the script will already be in the cache, causing the page to load faster.

    Ad@m

    0 讨论(0)
  • 2021-02-07 16:36

    Yes, it's completely safe. It's also hosted on Google's CDN making it load faster, in most cases, than loading from your own server.

    0 讨论(0)
  • 2021-02-07 16:41

    Google offers it for free. Google's servers are fast and above all you save your bandwidth.

    0 讨论(0)
  • 2021-02-07 16:48

    Absolutely, it is what you should do!

    http://encosia.com/3-reasons-why-you-should-let-google-host-jquery-for-you/

    0 讨论(0)
提交回复
热议问题