I am building an ASP-NET CORE 3.1 MVC Web Application. I wish to use the CDNJS network to provide my script resource files, and since this is a production application, I must have a fallback to a local copy for when the CDN might be offline. This is a fairly basic task and I can successfully load multiple libraries such as Bootstrap 4.5, jQuery 3.3, etc.
As you may know, ASPNET core script tag-helpers have awesome functions built in to do what I want to do automatically. When trying to load jquery.unobtrusive-ajax.min.js
I am unable to decide what my fallback test function should actually be. The ????? below represents the code I cannot make work.
Basically, I need to write JS code that returns false
when the CDN is not available. This code will be plugged into the ?????.
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajax-unobtrusive/3.2.6/jquery.unobtrusive-ajax.min.js"
asp-fallback-src="~/lib/jquery-ajax-unobtrusive/jquery.unobtrusive-ajax.js"
asp-fallback-test="window.jQuery && ?????">
</script>