The Script Tag Helper
The fallback-src attribute
To use the Script Tag Helper, you should always supply a value for the fallback-src attribute, as an alternative to the regular src attribute. This is the path to the local file you want to use in case the CDN is not working as expected. It could look like this:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" asp-fallback-src="~/Content/jquery.min.js"> </script>
The fallback-test attribute
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" asp-fallback-src="~/Content/jquery.min.js" asp-fallback-test="window.jQuery"> </script>
<script src="https://cdnj.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script>(window.jQuery||document.write("\u003Cscript src=\u0022/Content/jquery.min.js\u0022\u003E\u003C/script\u003E"));</script>
This will ensure that if the CDN version is not successfully loaded, the local version will be included instead.