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

Forums / General Discussions / Trouble including JQuery

Trouble including JQuery

64 posts, 0 answered
  1. Jacob
    Jacob avatar
    8 posts
    Registered:
    18 Jul 2011
    18 Jul 2011
    Link to this post
    Hello,
    I'm attempting to use the ResourceFile control to embed JQuery in a custom control. Strangely, on some pages, I've had no difficulty, but in others, JQuery simply will not load.

    Here's roughly what my code looks like:

    <%@ Control Language="VB" AutoEventWireup="false" CodeFile="Control.ascx.vb" Inherits="OSCPA.Web.UI.Control" %>
    <%@ Register TagPrefix="sf" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" %>
    <sf:ResourceLinks ID="resourceLinks" runat="server">
        <sf:ResourceFile JavaScriptLibrary="JQuery" />
        <sf:ResourceFile Name="Telerik.Sitefinity.Resources.Scripts.jquery-ui-1.8.8.custom.min.js" />
        <sf:ResourceFile Name="~/CSS/Control.css" />
    </sf:ResourceLinks>

    In this case, ~/CSS/Control.css will successfully be loaded, but both JQuery and the jQuery UI file are ignored.
    Any ideas? I'm completely stuck on this. I figure it's a simple setting somewhere or a directive that I'm missing but I'm not sure.
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    21 Jul 2011
    Link to this post
    Hello Jacob,

    Can you please check if the loading of jQuery is conflicted by some other control inserting the library or some other conflicting library?

    Regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Jacob
    Jacob avatar
    8 posts
    Registered:
    18 Jul 2011
    21 Jul 2011
    Link to this post
    Hi Radoslav,

    Thanks for your reply. I did some more investigating, and it looks like jQuery is being loaded after all, although I cannot see where in the code. The problem seems to be occurring in external jQuery extensions -- I am trying to load some that are not included in Telerik's assembly after jQuery is loaded(pxToEm and EqualHeights) and the "$" object is not defined in these files. I have tried using Sitefinity's own ResourceFile control to load them as well as manually inserting into the head on Page_Init in the codebehind to no avail.

    Any ideas here? Thank you again!
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    26 Jul 2011
    Link to this post
    Hi Jacob,

    Can you post the markup you are using to include those libraries, as well as a link to a download location for the scripts? I will try to wrap up a quick widget which works with those.

    Kind regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Jacob
    Jacob avatar
    8 posts
    Registered:
    18 Jul 2011
    27 Jul 2011
    Link to this post
    Excellent, thank you! :)

    Here is how I was trying to include the resources:

    <sf:ResourceLinks ID="resourceLinks" runat="server">
        <sf:ResourceFile JavaScriptLibrary="JQuery" />
        <sf:ResourceFile Name="Telerik.Sitefinity.Resources.Scripts.jquery-ui-1.8.8.custom.min.js" />
        <sf:ResourceFile Name="~/CSS/SingleProductPurchaser.css" />
        <sf:ResourceFile Name="~/Scripts/pxem.jQuery.js" />
        <sf:ResourceFile Name="~/Scripts/jquery.equalheights.js" />
    </sf:ResourceLinks>

    pxem can be obtained from: https://github.com/johnantoni/jquery.pxem/blob/master/pxem.jQuery.js

    And equalheights can be obtained from: http://www.filamentgroup.com/lab/setting_equal_heights_with_jquery/ (you will need to scroll down to the code box).
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    01 Aug 2011
    Link to this post
    Hi Jacob,

    The problem appears to be that your libraries are being loaded before JQuery. This is caused by the RadScriptManager control. It first tries to load scripts coming from relative paths, then scripts from embedded resources, and finally from CDN. This breaks the operation of those scripts and we have requested that this behavior is fixed in the RadScriptManager control. For now the workaround would be to embed your libraries and request them from embedded paths.


    Best wishes,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Brad H
    Brad H avatar
    9 posts
    Registered:
    20 Aug 2009
    30 Aug 2011
    Link to this post
    What does this mean?

    "embed your libraries and request them from embedded paths."

    I have the following and I still get "$ is not defined"

    <sitefinity:ResourceLinks runat="server" ID="resourceLinks">
            <sitefinity:ResourceFile JavaScriptLibrary="JQuery" />
            <sitefinity:ResourceFile Name="Telerik.Sitefinity.Resources.Scripts.jquery-ui-1.8.8.custom.min.js" />
            <sitefinity:ResourceFile Name="~/global/js/midder.js" />
        </sitefinity:ResourceLinks>
  8. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    01 Sep 2011
    Link to this post
    Hi Brad H,

    Please take a look at those two tutorials:
    Walkthrough: Embedding a JavaScript File as a Resource in an Assembly
    HOWTO: Embedding javascript into a dll

    Lets say that in your SitefinityWebApp project you have a folder called /JS and in ths folder you put your scripts. From there on once you set them to be built as embedded resources they will be built in the SitefinityWebApp.dll and will be accessible through SitefinityWebApp.JS.JavaScriptFileName.js.


    All the best,
    Radoslav Georgiev
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  9. Jacob
    Jacob avatar
    8 posts
    Registered:
    18 Jul 2011
    13 Sep 2011
    Link to this post
    Is Telerik planning on changing the load order in a future version of Sitefinity so this fix is not required?
  10. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    16 Sep 2011
    Link to this post
    Hello Jacob,

    There is a way that allows you to load all scripts in one request. You need to use RadScriptManager in your template and define both the embedded and non-embedded scripts in the <CompositeScript> tag.

    Regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  11. Theodora
    Theodora avatar
    1 posts
    Registered:
    15 May 2007
    27 Sep 2011
    Link to this post
    Hello Radoslav,

    I'm having trouble getting the embedded jquery scripts to load AFTER my custom scripts that rely on jquery. I've tried embedding the files as resources as you suggested and also tried using the composite script tags with no luck so I have to assume I am doing something wrong.

    Could you please post a sample code for this? Assume no expert knowledge and explain it like I'm a 5 year old. Its very frustrating trying to get this to work.

    First attempt - 
    <sf:ResourceLinks ID="ResourceLinks1" runat="server">
            <sf:ResourceFile JavaScriptLibrary="JQuery" />
            <sf:ResourceFile Name="~/scripts/jquery.easing.1.3.js" />
            <sf:ResourceFile Name="~/scripts/my.jquery.script.js" />
        </sf:ResourceLinks>

    Second attempt - 
    Embedded the two custom scripts by setting build action to "Embedded Resource". Then what? How do I then reference these files so they are loaded? Could you please provide code to explain your statement -

    "will be accessible through SitefinityWebApp.JS.JavaScriptFileName.js

    Third attempt - 
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">       
            <CompositeScript>
                <Scripts>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                    <asp:ScriptReference Path="~/scripts/jquery.easing.1.3.js" />
                    <asp:ScriptReference Path="~/scripts/my.jquery.script.js" />
                </Scripts>
            </CompositeScript>
        </telerik:RadScriptManager>


    Thanks.
  12. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    30 Sep 2011
    Link to this post
    Hello Theodora,

    When in VS you mark the Script file to be built as embedded resource you have to:
    1) Edit the AssemblyInfo class to reference your script:
    [assembly: WebResource("SitefinityWebApp.scripts.jquery.easing.1.3.js","text/javascript")]

    2) Edit the ResourceLink to point to the embedded file:
    <sf:ResourceFile Name="SitefinityWebApp.scripts.jquery.easing.1.3.js" AssemblyInfo="SitefinityWebApp" />

    Greetings,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  13. Scott Rozman
    Scott Rozman avatar
    93 posts
    Registered:
    10 Oct 2012
    09 Nov 2011
    Link to this post
    Hi Radoslav-

    I spent a lot of time trying to make this work, including either embedded resources from items I've set to be embedded within the SitefinityWebApp or within a separate class library.
    After not getting it to work, I saw another forum post here (can't find it now) by Ivan that explained this normally looks for items within a specific Telerik resources namespace unless you make changes to the global.asax, but there was caution of doing this could break Sitefinity's use of embedded resources.

    If there is a way to make this work without breaking Sitefinity, I'd like to know.

    thanks in advance.

  14. Trevor
    Trevor avatar
    35 posts
    Registered:
    28 Jan 2012
    08 Mar 2012
    Link to this post
    Hi,

    I was following these instructions:
    http://www.sitefinity.com/documentation/documentationarticles/developers-guide/sitefinity-essentials/controls/utility-controls/resourcelinks-control 

    And then I ran into an issue.  Even though I set my First ResourceFile to be the JavaScriptLibrary JQuery, JQuery loads AFTER the other files I need, which are dependent on the JQuery library.

    Then I found this thread.

    Now, if I understand this right, the only way to include Javascript files that depend on a library into a control is to compile them as embedded resources into the project?? SO this means that I have to recompile the project for every change made in the script during development?

    I tried following the instructions given above in this post, and the result is an error..

    This is what I've done:

    In AssemblyInfo.cs:
    using System.Web.UI;
    [assembly: WebResource("SitefinityWebApp.Scripts.HomePageDocumentDownloadList.js", "text/javascript")]

    In my control template:
    <sf:ResourceLinks id="resourceLinks" runat="server">
     <sf:ResourceFile JavaScriptLibrary="JQuery"></sf:ResourceFile>
     <sf:ResourceFile Name="SitefinityWebApp.Scripts.HomePageDocumentDownloadList.js" AssemblyInfo="SitefinityWebApp" />
    </sf:ResourceLinks>

    In Visual Studio:
    1) Set ~/Scripts/HomePageDocumentDownloadList.js Build Action to be "Embedded Resource" in the "File Properties" window above my solution explorer

    This is the result, after recompiling:


    Server Error in '/' Application.

    Object reference not set to an instance of an object.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error: 

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace: 

    [NullReferenceException: Object reference not set to an instance of an object.]
       Telerik.Sitefinity.Web.UI.ResourceLinks.RegisterResource(ResourceFile resource) +1191
       Telerik.Sitefinity.Web.UI.ResourceLinks.CreateChildControls() +509
       System.Web.UI.Control.EnsureChildControls() +102
       System.Web.UI.Control.PreRenderRecursiveInternal() +42
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
    


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
     


    I tried adding this:
    <asp:ScriptManager runat="server">
      
    </asp:ScriptManager>


    Per this blog: http://www.sitefinity.com/blogs/gabesumner/posts/11-09-01/how_to_use_jquery_and_other_javascript_libraries_in_sitefinity.aspx

    No avail, same results.

    Has any progress been made in fixing this?  What am I doing wrong (I don't like the idea of compiling my JS but I will if it would at least work..)

    thanks,
    -trevor
  15. Trevor
    Trevor avatar
    35 posts
    Registered:
    28 Jan 2012
    08 Mar 2012
    Link to this post
    UPDATE:

    I tried this:
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">      
            <CompositeScript>
                <Scripts>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                    <asp:ScriptReference Name="SitefinityWebApp.Scripts.HomePageDocumentDownloadList.js" Assembly="SitefinityWebApp" />
                </Scripts>
            </CompositeScript>
    </telerik:RadScriptManager>

     in my control template in place of my ResourceLinks control, and now things seem to be loading in the proper order.  HOWEVER, now it looks like telerik is adding script to my script, which is breaking it:
    // Move jQuery to $telerik
    $telerik.$ = jQuery.noConflict(true);
    Uncaught ReferenceError: $telerik is not defined

    causing:
    Uncaught ReferenceError: $telerik is not defined 

    what's the deal?  how does one load javascripts into a control that use JQuery?

    thanks,
    -trevor
  16. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    09 Mar 2012
    Link to this post
    Yeah, it's way more of a pain in the ass than it needs to be...I've given up screwing around and just link in jQuery from the google CDN in my header....

    It would be great if in the "Templates" area there's a checkbox list of core libraries we can choose, and they render right in the header so posts like this don't have to continue :/
  17. Robert
    Robert avatar
    70 posts
    Registered:
    05 Feb 2009
    15 Mar 2012
    Link to this post
    Hi, anything new about this?

    This is such a basic requirement that I would expect it is on the top list of issues. If for example I want to extend jquery with some plugin I can't because the extension gets loaded before jquery, so it doesnt know about jQuery at all. Even the documentation claims ResourceLinks control loads scripts in correct order, but it doesnt.
  18. Randy Garza
    Randy Garza avatar
    19 posts
    Registered:
    24 Feb 2012
    27 Mar 2012
    Link to this post
    The following post explains why Sitefinity uses the $Telerik global variable and how to remove it:  Post

    Basically include the following lines of code in the RadScriptManager and you will be able to access JQuery via $ and JQuery:

    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" 
         <Scripts
             <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> 
             <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> 
             <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
         </Scripts
      </telerik:RadScriptManager>

  19. al
    al avatar
    1 posts
    Registered:
    07 Jul 2006
    24 Apr 2012
    Link to this post
    Well I haven't been able to get the ResourceLinks working, but I got my scripts loading from code-behind using:

    protected override void OnInit(EventArgs e)
            {
                base.OnInit(e);
     
                ScriptManager.RegisterClientScriptInclude(this.Page, typeof(Registration), "myjQuery", "Scripts/jquery-1.7.2.min.js");
                ScriptManager.RegisterClientScriptInclude(this.Page, typeof(Registration), "myKnockout", "Scripts/knockout.js");
            }

    Hope this helps.
  20. Tim
    Tim avatar
    258 posts
    Registered:
    22 Jun 2011
    29 Apr 2012
    Link to this post
    Steve hit the nail on the head. Plus, using the Google CDN for your jQuery just feels good. :)

    For the skeptics:
    6,953 reasons why I still let Google host jQuery for me

    From the HTML5 Boilerplate:
    <!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"><\/script>')</script>

  21. Nancy
    Nancy avatar
    35 posts
    Registered:
    10 Apr 2012
    11 May 2012
    Link to this post
    I just tried adding Al's code to my code behind:
    protected override void OnInit(EventArgs e)
        {
          base.OnInit(e);
     
          ScriptManager.RegisterClientScriptInclude(this.Page, typeof(Registration), "myjQuery", "Scripts/jquery-1.7.2.min.js");
        }
    I get an error in Visual Studio stating "The type or namespace 'Registration' could not be found. are you missing a using directive or assembly reference?" I understand the concept here, but I am new to .Net and Sitefinity so I don't know what I need to include. My .cs file currenlty has these directives:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    What else do I need to add?

    Thanks you for your help.
  22. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    11 May 2012
    Link to this post
    Hey Nancy,
      If you're using Visual studio, just click on the word Registration, then hover your mouse on it...a helper box will popup, and if you hover over that it SHOULD let you add the using from there :)

    Also, JustCode will help a lot with this

    Here's a video of what I mean: http://screencast.com/t/SJFoFDMPa
  23. Nancy
    Nancy avatar
    35 posts
    Registered:
    10 Apr 2012
    11 May 2012
    Link to this post
    Hi Steve,
    Thanks for 'teaching me to fish'. I tried it and the little popup gave me the option to Generate a class for 'Registration' or Generate new type. Neither of those was very helpful in terms of solving the particular issue. I will look at JustCode too.
    In the mean time, I found another option that seems to get the scripts loaded in the correct order. Can't remember where I saw this, but it uses the Sitefinity javascript embed control in the master page.
    <%@ Register TagPrefix="sf" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.PublicControls"%>
     
    <sf:JavaScriptEmbedControl runat="server" ID="jsLink2" ScriptEmbedPosition="InPlace" Url="~/Scripts/libs/jquery-1.7.1.min.js"></sf:JavaScriptEmbedControl>
      <sf:JavaScriptEmbedControl runat="server" ID="jsLink3" ScriptEmbedPosition="InPlace" Url="~/Scripts/jquery.tweet.js"></sf:JavaScriptEmbedControl>
      <sf:JavaScriptEmbedControl runat="server" ID="jsLink4" ScriptEmbedPosition="InPlace" Url="~/Scripts/plugins.js"></sf:JavaScriptEmbedControl>
      <sf:JavaScriptEmbedControl runat="server" ID="jsLink5" ScriptEmbedPosition="InPlace" Url="~/Scripts/script.js"></sf:JavaScriptEmbedControl>
    It seems to be working fine and things are loaded in the correct order.
    Thanks again for your help.
  24. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    11 May 2012
    Link to this post
    Yep, I also do that :)

    ...I feel like I'm beating a dead horse here, but @Telerik, can you please make this easier for everyone involved.  Have a peek over at jsFiddle...you can pick a core framework, then link in resources...even that is way better than this  :/  We need more control.
  25. Nancy
    Nancy avatar
    35 posts
    Registered:
    10 Apr 2012
    11 May 2012
    Link to this post
    I made one small change. I am loading jQuery using the ResourceLinks so it won't get loaded twice if something else has already loaded it. Then, I add the other scripts in after using the JavaScriptEmbedControl. Now it looks like this:
    <asp:ScriptManager></asp:ScriptManager>
      <sfui:ResourceLinks ID="resourcesLinks" runat="server">
        <sfui:ResourceFile JavaScriptLibrary="JQuery" />
      </sfui:ResourceLinks>
       
      <sf:JavaScriptEmbedControl runat="server" ID="jsLink4" ScriptEmbedPosition="InPlace" Url="~/Scripts/plugins.js"></sf:JavaScriptEmbedControl>
      <sf:JavaScriptEmbedControl runat="server" ID="jsLink5" ScriptEmbedPosition="InPlace" Url="~/Scripts/script.js"></sf:JavaScriptEmbedControl>
    Ta-da!
  26. Gabe Sumner
    Gabe Sumner avatar
    440 posts
    Registered:
    09 Sep 2007
    11 May 2012
    Link to this post
    ...I feel like I'm beating a dead horse here, but @Telerik, can you please make this easier for everyone involved.

    I'll mention this thread to the team.  They'll probably agree the experience could be improved.  However, as always, it's a matter of weighing this against other priorities.

    --

    These days I'm doing a lot more writing than coding, so forgive me if my next statement is dumb ->  For scenarios where the load order of Javascript libraries is extremely important why not just use traditional HTML <script> tags in your MasterPage template and then move on?  

    Steve you mentioned you were doing this anyway (using Google's CDN version of jQuery) and Tim mentioned reasons why this is useful anyway.  By using plain HTML you can explicitly control the load order of these libraries.  Why even get ASP.NET involved?  I feel like I'm missing something here.  

    Gabe Sumner
    Evangelist
    Telerik | Sitefinity CMS
  27. Dan
    Dan avatar
    1 posts
    Registered:
    18 Feb 2012
    11 May 2012
    Link to this post
    Hi Nancy, this is Al (I have two accounts here),

    Just replace the class name "Registration" from my example with the name of your class.
    If you are including at the user control code behind level, use the class name of the user control.
    If you are doing it globally in your master page code behind, use the master page class name. An even better example was recently posted on the Falafel software blog:
    http://blog.falafel.com/Blogs/george-saadeh/2012/05/09/using-jquery-and-other-javascript-libraries-in-sitefinity

    Al
  28. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    11 May 2012
    Link to this post
    @Gabe
      Priorities I know, but this is a perpetual issue\forum topic :)

    Why not use script tags:
        - Can't do this on generated templates, only masters
        - Including jQuery this way actually loads THREE instances of the jQuery library.  One from the RadControls, one from SF, and the one from the CDN...thats a big problem.
        - If it's just a script it means it loads in the page designer, which is a no-no right?

    The problem IS asp.net and the stupid script manager :).  Believe me, I'd LOVE to just use Jochems html5 boiler and think that the only scripts coming down are those that I define, but alas, there's still a bunch of axd resources that asp.net throws at me.  Furthermore if I tell sitefinity to use the google jQuery CDN, the backend of sitefinity breaks and is rendered totally useless.

    We need a way to reliably load scripts in a certain order, and optionally define where they will load.  Not just advanced users, but super novice users who are trying to get a jQuery slider they downloaded to work.  What happens now is they come here and post about it.

    Know what I mean?
    Steve
  29. Gabe Sumner
    Gabe Sumner avatar
    440 posts
    Registered:
    09 Sep 2007
    11 May 2012
    Link to this post
    Ok, I'll see what I can dig up internally on this issue.  Thanks for details.  :)

    Gabe Sumner
    Telerik | Sitefinity CMS

  30. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    11 May 2012
    Link to this post
    Somebody call my name?

    I'm with Tim on this and normally use the boilerplate approach of Google CDN with a local fallback, @Steve's reference to my SF Boilerplate also uses this system; but ultimately it's a 'hack' because the system is broken.

    @Gabe
    Telerik uses their 'altered' version of jQuery for the backend, but also offers CDN support which in theory should load the Google CDN version. The problem is, the CDN system has been broken for several releases (jQuery url wrong, msajax causes hangs and heavy double loading of js).

    As Steve pointed out, everyone wants the most minimal and fastest approach. So some try and manually load Google CDN others opt for the embedded version. But currently there's no control over exact loading order the scripts.

    I can adhere to 'boilerplate/bootstrap' best practice and stuck jQuery at the end of my masterpage but if some widget gets dropped on the page that requires jQuery I'm in trouble.

    For standard templates (no external masterpage to hardcode jQuery) I can use a JS widget naturally, but that also gives me no load order control - even when I place it as loading in the head section, I'm bound to end up with Kendo missing jQuery (happened on several occasion).

    And Steve's also right about the double or triple loading of jQuery... something that totally negates the idea of fast or 'mobile' web design.

    I've posted several times on the forums with each new release, with regards to jQuery/Javascript and the CDN. 

    ---

    Basically, because scriptloading and cdn isn't manageable at the moment, we're forced to manually add it ourselves, which works if you know what you're doing, but results in double or tripple loading...

    Jochem


64 posts, 0 answered
1 2 3