I've just enabled UnobtrusiveValidation in my webforms site using the global.asax changes:
Protected Sub Application_Start(sender As Object, e As EventArgs)
Dim jquery As New ScriptResourceDefinition
jquery.Path = "~/js/jquery-1.11.1.min.js"
jquery.CdnPath = "http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"
jquery.CdnSupportsSecureConnection = True
ScriptManager.ScriptResourceMapping.AddDefinition("jquery", jquery)
End Sub
It works great, however, I already link to Jquery in my Master page(s) manually (their inclusion order in the <head>
is very important so I control this myself)
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
//<![CDATA[
window.jQuery || document.write('<script src="/js/jquery-1.11.1.min.js">\x3C/script>')
//]]>
</script>
My problem is that I now see duplicate requests to the JQuery file in Firebug. I read ages ago how to prevent this happening, but can no longer find the source in amongst all the search engine noise. Is there a way to remove the ScriptResourceDefinition's rendering of the Jquery file.
I removed my manual links as a test, but ASP.Net only renders the Jquery link when it needs to render validators, whereas I need it on every page.