I am working in SharePoint 2010, and using jquery to modify some display and edit forms throughout a site. To do so, I'm including a reference to the jquery library in the site's v4.master page so I can use it across multiple forms and lists. My reference looks like this:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
This works great for a while, but twice now this setup has suddenly stopped working. On the webpage for the end user, suddenly the scripts are not working. The console errors reveal that now "jquery is undefined".
When I "View Source" I find that my reference to jquery in the v4.master page has been altered before it made it to the client, and now looks like this:
<script src="/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
...as you see, SharePoint has stripped out the domain name "//ajax.googleapis.com" referenced here, seemingly out of the blue. Nothing was changed with the v4.master since I initially put it in, so SharePoint suddenly began outputting it differently.
The solution for me was simply to open v4.master - make NO changes (because the original URL was still fully there) - and simply save it again. Then everything was back. Almost as if I was refreshing or replacing some cached version somewhere. But why would that cached version have stripped out the domain?
I'd obviously prefer not to have to open/save this thing every month...does anyone know why SharePoint would do this at an arbitrary time, with no changes to provoke a break? Is there really a cached copy being made here? And if so, why would it cache a different copy than its been using for a month?