By Roi Kolbinger - SharePoint Consultant KWizCom Professional Services – www.kwizcom.com
Did you ever notice that SharePoint pages that display "views" loads slower if you have set a default site direction?
When I open a list view (allitems) with Firefox it loads in a second, with Explorer the same page loads in three seconds. Why?
When considering it two extra seconds may not seem like a lot but the extra moment here and there end up being wasted hours sucked up by the computer. Who have us hasn't sat down to work on a project and after what feels like moments, raised eyes to the clock only to find that in actuality hours had flown by? Every moment is precious and I wanted to discover why the page was loading so much slower…
Curious, I decided to investigate… I began by debugging the JavaScript page using a small function called "FixTextAlignForBidi". This function verifies that your browser is Explorer. If it is, this application runs all the elements on your page and changes the textAlign (left or right) according to what you defined when you created the list.
If you use "none" as your default this function will not run and your page will load faster.
If that doesn't work then a different solution is needed.
Once I discovered the source of the difficulty I was able to figure out how to fix it:
If you use one language on your sites, go to init.js, find the function and add a return method at the beginning like so:
function FixTextAlignForBidi(value)
{
return;
if (!browseris.ie)
return;
...
After this, go to core.css (or your style file) and add this code to create a default textAlign:
Left alignment:
/* FixTextAlignForBidi(left) on init.js */
.ms-vh-icon, .ms-vh-icon-empty, .ms-vh2-nograd, .ms-vh2-nograd-icon, .ms-vh2-nofilter, .ms-vh2-nofilter-icon, .ms-vhImage
{
text-align: left;
}
Right alignement:
/* FixTextAlignForBidi(right) on init.js */
.ms-vh-icon, .ms-vh-icon-empty, .ms-vh2-nograd, .ms-vh2-nograd-icon, .ms-vh2-nofilter, .ms-vh2-nofilter-icon, .ms-vhImage
{
text-align: right;
}
If you use two directions on your site you can attack the problem a few ways.
One way is to create two style sheets and add to the files the code as appears above.
An alternative is to allocate the faster speed to the main alignment direction you are using, for example:
If you choose the left side to be the faster one you add the left style to the css file, and in the JavaScript function you add if
function FixTextAlignForBidi(value)
{
if (!browseris.ie)
return;
if (value == "left")
return;
...
If you chose the right side, do the opposite.
After that you should have no more difficulties with the loading speed of your pages.
******************
For more useful tips and guidelines please visit the KWizCom blog at: http://kwizcom.blogspot.com/
You can try KWizCom SharePoint and Dynamics CRM add-ons free of charge: http://www.kwizcom.com/
No comments:
Post a Comment