Load scripts after jQuery
Is it possible to load scripts that depend on jQuery after jQuery itself loads? Or is it possible to short-circuit sitefinity's reference to jQuery and load my own?
Hi Bryan,
You can use JavaScriptEmbedControl.
ScriptEmbedPosition- Specifies where to embed the script - head tag, in place or before the closing body tag
Url - Gets or sets the URL of the script file
CustomJavaScriptCode - Custom java script code
LayoutTemplateName - Gets the name of the embedded layout template.
Another option is to create your own control where you use
RegisterClientScriptBlock and check for IsClientScriptBlockRegistered before adding some dependent scripts on a page.
Sincerely yours,
Ivan Dimitrov
the Telerik team
Thanks Ivan,
Problem with this for years now. Solution is to embed scripts into dll, due to load order.
But please think about it: 2019 soon JQuery is base plugin for many web components, and we still not able to easily include a simple script on the server without embed it or make or custom component.
use jQuery and add <script src="/myTestScript" /> is the base you see in all tutorials in all components based on it.
It should be easier to test or include some file afetr it.
Please you really need to fix that behavior.
A precision about the JavaScriptEmbedControl, you can't use this in a widget, if you add 2 widget in same page your script will be executed twice.