|
|||||||
![]() |
Forum Index > glFusion > glFusion Support |
|
|
Possible Performance improvement. |
|||
| | | Printable Version |
|
kingsley | ||||||||
|
In talking with some folks about performance issues with a site they suggested that I move the Java Script calls on the site to the end instead of having them load first in the header. They claimed that this would give an appearance of faster loads although overall load times wouldn't change. PHP Formatted Code {# Load JavaScript #}<script type="text/javascript" src="{js_cache_url}"></script> {# Load plugin Header Code #} {plg_headercode}
PHP Formatted Code <script type="text/javascript" src="http://72.46.237.18/js.php?t=nouveau"></script> <link rel="microsummary" href="http://72.46.237.18/index.php?display=microsummary" title="Microsummary" /> <!-- Bad Behavior 2.0.26 run time: 12.327 ms --> <script type="text/javascript"> <!-- function bb2_addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } bb2_addLoadEvent(function() { for ( i=0; i < document.forms.length; i++ ) { if (document.forms[i].method == 'post') { var myElement = document.createElement('input'); myElement.setAttribute('type', 'hidden'); myElement.name = 'bb2_screener_'; myElement.value = '1244821641 75.147.4.85'; document.forms[i].appendChild(myElement); } } }); // --></script>
JavaScript scripts block parallel downloads; that is, when a script is downloading, the browser will not start any other downloads. To help the page load faster, move scripts to the bottom of the page if they are deferrable.
|
![]() Active Member Group Comfort Level:: +7 Status: offline ![]()
Registered: 02/12/06 |
||||||||
|
|||||||||
|
Mark | ||||||||
|
I've always heard it is best to put the JS in the footer if possible. I don't see any reason why we couldn't give it a try. It would take a very minor modification to the header / footer code to make sure the template variables are available in both places. Let me play around with it a bit and see how it works. glFusion - Enhanced Content Management |
![]() Admin Group Comfort Level:: +93 ![]() Status: offline ![]()
Registered: 10/21/05 |
||||||||
|
|||||||||
|
kingsley | ||||||||
|
Thanks Mark, |
![]() Active Member Group Comfort Level:: +7 Status: offline ![]()
Registered: 02/12/06 |
||||||||
|
|||||||||
| Content generated in: 0.22 seconds |
|
| All times are CDT. The time is now 09:24 AM. |
|
|