gpt4 book ai didi

jquery - 如何正确使用谷歌加载器

转载 作者:行者123 更新时间:2023-12-01 08:20:04 25 4
gpt4 key购买 nike

我已经使用以下内容一段时间了:

    <script src="https://www.google.com/jsapi?key=MY_API_KEY" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>

但是,我见过其他谷歌加载器替代品,例如只需加载 jQuery 本身(注意:http):

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>

这种替代方法意味着您不需要调用第一个示例。

使用 Google 加载程序时最好使用哪种方法?

最佳答案

您可以使用其中任何一个。正如Google Libraries API中提到的介绍中

The Libraries API provides your applications with stable, reliable, high-speed, globally available access to all of the most popular, open-source JavaScript libraries. Your application can use our very flexible loader google.load() or direct, path-based access to the scripts.

我更喜欢直接加载库(你的第二个选择),因为我认为不需要加载 google 库以及 jquery

如果您的页面本身是httpS,请使用httpS。否则,就使用http

关于jquery - 如何正确使用谷歌加载器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7902358/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com