cdn and fallback
https://www.davepaquette.com/archive/2015/05/06/link-and-script-tag-helpers-in-mvc6.aspx
It is a common approach to reference popular frameworks from hosted CDN in order to reduce network load on your server and potentially improve performance for the end user. For popular frameworks like jQuery and Bootstrap, there is a good chance that the browser will already have a cached version of these files.
Referencing files from a CDN can be a bit of a pain because you also need to provide a fallback to a version of the file hosted on your servers. A fallback is necessary because you do not want your application to go down just because the CDN is not currently reachable.
The script and link tag helpers make it easier to specify a fallback test and file location. Here is a basic example for the popular Bootstrap framework:
<link rel="stylesheet" href="//ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/css/bootstrap.min.css"
asp-fallback-test-class="hidden"
asp-fallback-test-property="visibility"
asp-fallback-test-value="hidden" /> <script src="//ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/bootstrap.min.js"
asp-fallback-src="~/lib/bootstrap/js/bootstrap.min.js"
asp-fallback-test="window.jQuery">
</script>
最新文章
- Bzoj3450 Tyvj1952 Easy
- 限制EditText最多输入多少汉字
- 吐槽!important专用博文
- C++实现反射机制
- [转]eclipse中使用maven插件的时候,运行run as maven build的时候报错
- Xcode中的Info.plist字段列表详解
- ctrl+c关闭多线程python程序
- linux建立信任关系
- Android手机配置gcc,实现手机编译代码
- 2014年1月9日 Oracle常见授权与权限回收[转]
- AFNetworking3.0的基本使用方法
- windows系统解决github.com访问超时
- 201521123001《Java程序设计》第8周学习总结
- K:图相关的最小生成树(MST)
- 线性回归(Linear Regression)均方误差损失函数最小化时关于参数theta的解析解的推导(手写)
- [Swift]LeetCode60. 第k个排列 | Permutation Sequence
- CODEVS 2455 繁忙的都市 SCOI2005(洛谷 P2330)
- Java数据类型转换规则
- 【译】第8节---EF Code First中配置类
- tar -cvzf a.tar.gz a --remove-files,tar命令执行原理