Skip to content

Instantly share code, notes, and snippets.

@ps-team
Created October 27, 2017 09:42
Show Gist options
  • Save ps-team/6c6eab7c6990a07dc46d13fa9de31347 to your computer and use it in GitHub Desktop.
Save ps-team/6c6eab7c6990a07dc46d13fa9de31347 to your computer and use it in GitHub Desktop.
Oh, man. This is horrible. But sometimes needed in older versions where you can't remove jQuery due to a control rendering it out. Honestly, don't use this.
'Jquery reference code
Dim js = From file In Javascript.Files
Where file.Key = "jquery"
if js.count > 0 then
Javascript.Files.Remove(js.First())
end if
Javascript.Files.Insert(0, New CMS_API.Utilities.Javascript.UrlJavascriptFileReference("/SiteElements/Scripts/jquery.js"))
'Note. If you're unlucky enough to be using the FontSizeSelector control, the above code won't work. You need to use the following in Custom Code;
Protected Sub Page_PreRenderComplete(ByVal sender As Object, ByVal e As System.EventArgs)
Dim js = From file In Javascript.Files
Where file.Key = "jquery"
if js.count > 0 then
Javascript.Files.Remove(js.First())
end if
Javascript.Files.Insert(0, New CMS_API.Utilities.Javascript.UrlJavascriptFileReference("//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"))
End sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment