2013年9月20日金曜日

jquery cdn 止まった時には

https://ajax.aspnetcdn.com/ajax/最近たまに止まりますね
jquery.tmpl.jsがあるから使ってるのに…

そういう時の対策として
jquery.tmpl.js読み込めてない場合に自前のjsを読み込むようにする


jqueryの場合は、htmlに下記を追加

<script>
window.jQuery || document.write(unescape("%3Cscript src='js/jquery-1.6.2.min.js'%3E%3C/script%3E"));
</script>




jquery.tmplの場合は、htmlに下記を追加

<script>
$.tmpl || document.write(unescape("%3Cscript src='js/jquery.tmpl.min.js'%3E%3C/script%3E"));
</script>


環境によってpathとかversionは変わります
読み込み順序には気をつけましょう

0 件のコメント: