Javascript issues (4.0.1210.0)

Posted by Community Admin on 04-Aug-2018 13:06

Javascript issues (4.0.1210.0)

All Replies

Posted by Community Admin on 01-Apr-2011 00:00

Because I'm nearing completion on one of my projects I thought and run it through YSlow and PageSpeed...

First point I'm hitting is 'minify Javascript'. As it turns out, webresouce and scriptresource aren't minified.
Looking a bit further, I came across this one...

// Name:        Telerik.Sitefinity.Resources.Scripts.MicrosoftAjax.debug.js
// Assembly:    Telerik.Sitefinity.Resources
// Version:     4.0.1210.0
// FileVersion: 4.0.1210.0

Is there a reason why we're using the debug version of MicrosoftAjax or did this just slipped into production version? Also I noticed it loads the regular (microsoftajax.js first and later the debug version).

Next is jQuery.
For some reason you decided to embed it (best practices dictate CDN, and do a local fall-back).
But since you embedded it, we're stuck with it. Analyzing the different scriptresources being loading I first come across version v1.4.2 and a few scriptresources later I come across v1.4.3 ?

Also, is there an 'official' way to override the embedded version? (Using v1.5.x instead of the embedded v1.4.2 and v1.4.3)

Thanks,
Jochem


Posted by Community Admin on 06-Apr-2011 00:00

Hello Jochem,

Please make sure that your website is not set to run in debug mode (this is configured from web.config):

<compilation debug="false" targetFramework="4.0">

If debug is set to true this will tell the ScriptManager to load the debug Microsoft scripts. Also I have checked our code and we do not use different versions of jQuery. In your current version of Sitefinity we are using jQuery 1.4.2. Please check if the reference to the other versions is coming from a custom widget/master page. With the upcoming release we have updated the version of jQuery to the latest official one. Also please note that we are using the Google CDN for delivering this library, refer to attached screenshot.

Also you can enable CDN for the AjaxScritps by going to Administration -> Settings -> Advanced -> Pages -> ScriptManager and selecting the CDN check box. Also please note that you can change the path of any of the built in referenced scripts (update their version) on demand.

Best wishes,
Radoslav Georgiev
the Telerik team

Posted by Community Admin on 06-Apr-2011 00:00

@Radoslav

Are you checking the same build (4.0.1210.0) as me?

I'm definately seeing 2x jQuery loading from ScriptResource.axd, one time v1.4.2 and one time v1.4.3.  The only 'widget' loaded on the page is a menu, a standard search box and several (textual) content blocks.

I know I can be blond sometimes, but I actually did check to see if I had compilation debug set to false. 

Thanks for telling me the CDN settings though, hadn't spotted them yet.

Any way I can show you that v1.4.2 and v1.4.3 are loaded? A screenshot won't really work...
Jochem.

Posted by Community Admin on 06-Apr-2011 00:00

Hi Jochem,

I am using the version of Sitefinity you have specified in your original post, so yes we are working with the same version. I see what I was missing before. The thing is the Navigation control - it uses RadControls for ASP.NET Ajax which use jQuery for their client side functionality. It loads a different version of jQuery and when it loads it it transfers it to $telerik:

// Move jQuery to $telerik
$telerik.$ = jQuery.noConflict(true);

This is done to prevent conflicts with other jQuery versions. We have look at certain ways to prevent this, however have not found a really feasible way. One which would allow you to update the version of jQuery used by Sitefinity. Do you still have the debug scripts being loaded?

Regards,
Radoslav Georgiev
the Telerik team

Posted by Community Admin on 06-Apr-2011 00:00

@Radoslav,

I just finished a clean set-up / test case scenario. Look at the attached image.

To the left you see a standard page with navigation control on a custom masterpage. To the right you see that same page run with an 'integrated' masterpage.

The 'custom' masterpage is totally empty except for placeholders, also no codebehind code or anything and yet instead of 6 requests it's hitting 20 requests (including the double jquery and the ajax.debug.js). I even emptied it further out to 1 placeholder but still it's hitting 20 requests....

*lol*  Is this punishment for not being modern and sticking to custom masterpages or am I missing something?

(... 20mins further...)

Well I think I've found what's causing the mayhem, perhaps you can confirm but if I remove the <asp:scriptmanager> tag from the custom masterpage, everything seems to go normal and we're hitting those 6 requests instead of 20.

Jochem.

Posted by Community Admin on 06-Apr-2011 00:00

-- follow up --

With scriptmanager in custom masterpage:
20 requests.
301.K download
Loading of jQuery v1.4.2 AND v1.4.3
Loading of MicrosoftAjax.js AND MicrosoftAjax.debug.js



Without the scriptmanager tag in custom masterpage:
7 requests
826.8K download ( not a typo, it increased +500K)
Loading of jQuery v1.4.2 AND v1.4.3
Loading of MicrosoftAjax.js AND MicrosoftAjax.debug.js


With regards to the MicrosoftAjax.js:
I'm seeing a  /* START MicrosoftAjax.js */ and /* START Telerik.Sitefinity.Resources.Scripts.MicrosoftAjax.debug.js */ getting loaded. Switching compilation debug setting in web.config doesn't have affect on the .js being loaded, it's definately there.

Jochem.

Posted by Community Admin on 12-Apr-2011 00:00

Hello Jochem,

I am testing with our latest build that will be released as 4.1 (Q1 release). The debug=false" setting works as expected. When you use it, minified versions of the scripts are loaded. This should also apply to Sitefinity scripts from 4.1 (previously did not).

There is still two instances of jQuery loaded - one from Sitefinity and one from RadControls, as Radoslav mentioned. We still do not have solution to this.

What's worth noting:

When you use a ScriptManager in your master page, it does not handle the script combining logic. Internally, if no other ScriptManager is found, we include a RadScriptManager and set its combining to true or false based on a configuration setting. By default combining is on, so it should load just a few scripts from the server. In the case I am testing, only two scripts are loaded, one of them is the combined script. If I turn off script combining I get around 7 scripts loaded. This is on a page with a navigation + a content block (similar to your screenshot).

Also note, that the count of the loaded scripts depend on whether you use inline editing. If it is on, more scripts are loaded because they are required. To test without inline editing, open the page in a browser where you are not logged in Sitefinity.



Greetings,
Lyubomir Dokov
the Telerik team

Posted by Community Admin on 12-Apr-2011 00:00

@Lyubomir

Me is smiling!

Posted by Community Admin on 19-Mar-2012 00:00

Lyubomir

Has a solution to this ever been found? I'm also seeing two versions of the JQuery file in SF 4.4.2117.

From a performance point of view this is just not feasible. Customers are getting to the point where they want to squeeze every bit of performance out of their websites and have double requests for the same library just isn't professional at all.

Posted by Community Admin on 19-Mar-2012 00:00

Lyubomir

Has a solution to this ever been found? I'm also seeing two versions of the JQuery file in SF 4.4.2117.

From a performance point of view this is just not feasible. Customers are getting to the point where they want to squeeze every bit of performance out of their websites and have double requests for the same library just isn't professional at all.

Posted by Community Admin on 19-Mar-2012 00:00

@J

I'm not Lyubomir but atm (v5.0.2523) there is still no solution for the 2 jQuery versions.
Whenever you place a 'RadControl' on a page, it loads its own embedded version of jQuery.

The Sitefinity theme pulled rank on the KendoUI team and managed to keep (their jQuery) out, but so far nobody's been able to convince the RadControls Team that including jQuery instead of taking a dependency on it (like the rest of the world including Microsoft does) is no longer the best approach....

Jochem.

Posted by Community Admin on 19-Mar-2012 00:00

Are all of the built-in widgets "RadControls"?

...how do I find out which Sitefinity features were based on the RadControl product?

Excellent thread. I learned a lot here. I was looking into this myself.

Posted by Community Admin on 19-Mar-2012 00:00

@Dan,

The Navigation widget (menu/tabstrip/panelbar etc). The RadEditor (comments / forums). And I believe the Social sharing (not the widgets but the options introduced within news/blogs). All these are based on the standard RadControls Telerik offers.

Under Administration >> Advanced >> Toolboxes >> Toolboxes >> PageControls >> Sections >> RadControls they provide all the 'standard' RadControls as well as widgets, but by default this widget section is disabled.

Since 'navigation' is a pretty standard thing to implement on a website :), it's kind of an issue for people wanting a lean and fast loading site... 

---
If you're interested in the latest rant on Javascript loading and optimization you might want to check this post (based on Sitefinity v4.4) - haven't had time yet to do my quarterly update on v5 yet...

Jochem.



This thread is closed