Viewing Enter javascript just before >/body tag>

Enter javascript just before >/body tag>



User: Peter B. 12 years ago
Hi

Currently EW uses some javascript files to offer widget functionality. This is great.
Yet these scripts are loaded at the top of the page, thus preventing the rest of the page being loaded as browsers will have to wait for the javascript interpreter to load the file and execute it before the browser resumes loading the rest of the page.

By placing all javascript code in " the footer" you prevent pages from taking ages to load due to javascript.
User: Roddy 12 years ago
Quote:
By placing all javascript code in " the footer" you prevent pages from taking ages to load due to javascript


It's more likely that images and other media files will slow page download time than any javascript placed in the head.

In EverWeb, javascript can be entered into the head of the doc via the Head Code box, the body via a Snippet and just before the closing body tag via the Footer code box. At the moment, it cannot be inserted below the footer via a widget but can be inserted into the body along with the HTML if that is necessary for the project to work.

There are no hard and fast rules about javascript placement. Some projects require that related the javascript goes into the head - otherwise they won't work.

In a perfect world, javascript should be loaded in sequence with the HTML & CSS for the object. Each instance needs to be considered on a case by case basis using experience, trial and error or guesswork!

Most web pages with a slider on them place it at or near the top of the page. In this case, the javascript needs to load ASAP and should be placed in the head.

The only hard and fast rule that I have with placing javascript is to put statistics and social media related stuff last.

-------------------------------
Roddy

Website: http://everwebwidgets.com
Contact: http://everwebwidgets.com/ewWidgets-home/contact.html
NOTE: I am an EverWeb user and NOT affiliated with EverWeb! Any opinions expressed in this forum are my own.


Post Reply
You must login or signup to post.