LoginSignup
37
40

More than 5 years have passed since last update.

jQueryとBootstrapのCDN(Content Delivery Network)

Last updated at Posted at 2015-01-30

多くのサイトで利用しているCDN読み込みだとクライアント側でのキャッシュの効果が見込めるのでそれぞれ一択で

jQuery

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

jQuery Mobile

<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.3/jquery.mobile.min.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.3/jquery.mobile.min.js"></script>

jQuery UI

<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>

Bootstrap

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>

CDNが停止していたらローカルのファイルを読み込む設定例

<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery-ui.min.js"><\/script>')</script>

もしCDNにアクセスできなければ、ローカルのファイルを読みこむ

37
40
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
37
40