More in this section
Forums / Bugs & Issues / The amount of javascript blocks in pages

The amount of javascript blocks in pages

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
5 posts, 1 answered
  1. Geert
    Geert avatar
    2 posts
    30 Apr 2011
    29 Jun 2011
    Link to this post
    I'm new to Sitefinity as a front-end developer and my web development company is in the process of deciding whether to use Sitefinity as the default CMS for all future clients. One major issue I have with Sitefinity is the amount of javascript code blocks it outputs in web pages. In our current example page (which unfortunately I can't share here) there's several inline code blocks (script tags early in the body area of the html) and several externally referenced ones aswell. The total size is not a huge problem (around 50Kb in our example), but I fear for the rendering speed of the pages. Both inline script blocks and external references (http requests) have a negative effect on load times. Besides that it's an issue of code neatness.

    My questions:

    - Is there anything a developer can do to reduce the amount of javascript generated?
    - Are all these scripts necessary? The page does not use any Telerik controls, no drop down menu or anything. Only a few custom scripts which we've placed in the masterpage ourselves (those are the only ones we were hoping to see).

    Any help, explanation or advice appreciated, and my apologies if this has been brought up before.
  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    18 Sep 2017
    01 Jul 2011
    Link to this post
    Hi Geert,

    If you are using jQuery in your scripts they might get in conflict with some Sitefinity jQuery. You may try to resolve the conflicts with noConflict().

    1)The default javascript generated is needed for Sitefinity page as it is not showing static content. Some of this javascript can be reduced by disabling Browse and Edit functionality. To disable it go to Administration -> Settings-> Advanced-> Pages  and set EnableBrowseAndEdit to False this will remove it from the last javascript block containing the loadHandler. the default scripts on an empty page should not slow your performance as with them the page is requested in about 600ms when deployed in IIS( without images that have not been already cached).
    2) The scripts added are necessary. They can be reviewed at Administration -> Settings-> Advanced-> Pages-> Script manager-> Script References. The script that is always loaded is the loadHandler and Telerik.Web.UI.WebResource.axd which contains the scripts for widgets and also provides script combining to reduce the server calls for the necessary scripts and puts them all in a single file which is cashed and they will not have to be requested again. This happens when the page is requested for first time. If you remove a script from script references Sitefinity breaks. You can test deploying a project in IIS as the integreted web server in Sitefinity is not as fast as IIS and observe the load these scripts cause. You can do Asynchronous Javascript loading for your script to improve performance.

    Stanislav Velikov
    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. David
    David avatar
    114 posts
    19 Jul 2012
    17 Jun 2016 in reply to Stanislav Velikov
    Link to this post
    Our home page uses javascript for a slider.  How can I load this Async.  There is no option in the JavaScript widget?
  4. Victor Leontyev
    Victor Leontyev avatar
    65 posts
    01 Jul 2014
    22 Jun 2016 in reply to David
    Link to this post

    Hi David. 

    If you are using Feather and JavaScript widget. And you need async attribute

    I can suggest you to duplicate all code from existing widget ( and just add async attribute inside template. And, of course, rename it for example "JavaScript Async" 

  5. David
    David avatar
    114 posts
    19 Jul 2012
    28 Jun 2016
    Link to this post
    We are currently using the normal sitefinity widgets.
5 posts, 1 answered