User1100692814 posted
Hi Eagle_f90,
In the latest release, the Bundle class includes the property CdnFallbackExpression.
If you render a bundle that uses a CDN with the CndFallbackExpression specified, the framework renders a bit of script into the DOM for the fallback check. For example, if you setup your bundle as follows,
bundles.UseCdn = true;
var jqueryCdnPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js";
var bundle = new ScriptBundle("~/scripts/jquery", jqueryCdnPath)
{
CdnFallbackExpression = "window.jquery"
};
bundle.Include("~/scripts/jquery-{version}.js");
To load jquery from ajax.aspnetcdn.com. The framework will insert:
<script src=”http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"><\/script>
<script>
(window.jquery)||document.write(
"<script src=”/scripts/jquery"><\/script>")
</script>
Hope this helps.
D