1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Load scripts after jQuery

Load scripts after jQuery

3 posts, 0 answered
  1. Bryan
    Bryan avatar
    62 posts
    Registered:
    20 Jul 2010
    14 Sep 2010
    Link to this post
    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?

    I've tried just about everything.  Seems like this should be pretty easy but I am probably just missing something.

    Thanks,
    Bryan
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    14 Sep 2010
    Link to this post
    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
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Bryan
    Bryan avatar
    62 posts
    Registered:
    20 Jul 2010
    14 Sep 2010
    Link to this post
    Thanks Ivan,

    That was the approach I took earlier.  The problem I ran into was that sitefinity used my fully qualified local host address in the javascript src so when I move the application to my staging server the references break.  Perhaps a suggestion could be offer a checkbox in the properties of the JavaScriptEmbedControl indicating whether to use a path relative to the application root.  Or even allow the "~" to indicate that the location is relative to the application root (because I did try this approach and, well...).

    Thanks for your help.
    Bryan
3 posts, 0 answered