【问题标题】:Where in a WebMatrix project should the jquery CDN reference be placed?在 WebMatrix 项目中应该将 jquery CDN 引用放在哪里?
【发布时间】:2013-04-21 15:22:58
【问题描述】:

我在这里看到:Where do you include the jQuery library from? Google JSAPI? CDN? 这是从 CDN(Google 的)包含 jQuery 的好方法:

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

由于 jQuery 2 刚刚发布,我打算使用:

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

...还有最新的 jQueryUI:

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

注意:这些 sn-ps 与上面链接的 Stack Overflow 上的“规范答案”相同,来自 google 的 jQuery CDN 页面:https://developers.google.com/speed/libraries/devguide#jquery-ui

现在我的问题是:在 WebMatrix 项目中,对 CDN 的引用应该放在哪里?在 网络配置? _AppStart.cshtml? _SiteLayout.cshtml?还是……???

【问题讨论】:

    标签: jquery google-api cdn webmatrix


    【解决方案1】:

    _SiteLayout.cshtml 就是这个地方:

    . . .
    <script src="~/Scripts/jquery-2.0.0.min.js"></script>
    <!-- May want to replace the above before deploying with:
    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
    ..and similar for jquery-ui -->
    <script src="~/Scripts/jquery-ui-1.9.2.js"></script>
    . . .
    

    当然,需要从http://code.jquery.com/jquery-2.0.0.min.js下载jquery-2.0.0.min.js,放到项目的Scripts文件夹中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-09
      • 2010-09-15
      • 2014-09-06
      • 1970-01-01
      • 1970-01-01
      • 2011-04-06
      • 1970-01-01
      相关资源
      最近更新 更多