Web Design Forum  
 
Go Back   Web Design Forum > Web Software > Scripts

Reply
 
LinkBack Thread Tools Display Modes
Old 01-12-2011, 08:33 AM   #1
New Member
 
Join Date: Dec 2010
Location: Doncaster, S. Yorks
Posts: 16
Default External scripts

I have seen some cool JS scripts that I wouldn't mind using on my site. For the sake of tidiness, I wouldn't mind just putting them all in one file, and linking to that from the web pages, instead of having 5 or 6 seperate links for each script. I'm not sure which is the best way though, doing it like this, or just keeping everything seperate. Would there be a load time increase on the page, or any other problems?

Any advice is appreciated.

Thanks,

Stu
stuartpb is offline   Reply With Quote


Old 01-13-2011, 04:21 AM   #2
Gold Member
 
smoovo's Avatar
 
Join Date: Oct 2010
Posts: 388
Default

Any kind of file embedding, like JS, CSS, images, etc. will force HTTP request. HTTP requests taking time, and it is better to have low as possible requests.

If you will have all the JS scripts in one file it will increase your page speed. The thing is, some of the JS codes have to be linked in the header, and some right before the ending body tag. If you have this two kind of scripts, you can make two files, and embed one in the header and one right before the ending body tag. Either way make it all-in-one as possible.

Another thing is that some pages are not using one or two of this scripts, so adding them to the page will make the page slower.

Think about it and try to understand and figure what the best solution for your website, and faster is better.

- Good Luck.
__________________
SMooVo - Web Design & Development
contact@smoovo.com
www.SMooVo.com
smoovo is offline   Reply With Quote
Old 01-13-2011, 11:00 AM   #3
New Member
 
Join Date: Dec 2010
Location: Doncaster, S. Yorks
Posts: 16
Default

Thanks a lot for the info, and I've minimised the JS and also the CSS. Load times weren't a problem on the site, but at least I know that everything's optimised.

Cheers,

Stu
stuartpb is offline   Reply With Quote
Old 01-13-2011, 02:34 PM   #4
Gold Member
 
smoovo's Avatar
 
Join Date: Oct 2010
Posts: 388
Default Improve page speed

My pleasure.

You can optimize page speed in many ways; Sprites, Images file size (jpg vs. png), Minify Scripts, etc.

See Google's page speed explanation.

- Have Fun.
__________________
SMooVo - Web Design & Development
contact@smoovo.com
www.SMooVo.com
smoovo is offline   Reply With Quote
Old 01-14-2011, 11:49 AM   #5
New Member
 
Join Date: Dec 2010
Location: Doncaster, S. Yorks
Posts: 16
Default

Thanks again

The google page was a good read, and definitely gave me some good pointers.
stuartpb is offline   Reply With Quote


Old 01-14-2011, 03:31 PM   #6
Bronze Member
 
Dorky's Avatar
 
Join Date: Oct 2009
Posts: 33
Default

Sprites are segmented and also require further http requests. do you mean sliced?
Dorky is offline   Reply With Quote
Old 01-17-2011, 09:19 PM   #7
Gold Member
 
Join Date: Nov 2010
Posts: 324
Default

I think everything's well now. Taking smoovo's advice is a good thing!!
__________________
FTP hosting
che09 is offline   Reply With Quote
Old 10-14-2011, 10:45 AM   #8
New Member
 
Join Date: Oct 2011
Posts: 5
Default

# Use external JavaScript files when you want to use the same script on many pages, but don't want to have to rewrite the code on every page!
# Use external JavaScript files for including both types of scripts: the type that you place in the head (functions) and the type you place in the body (scripts you want to run when the page loads).
__________________
Date My School
peterjoys is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:15 PM.


Camera Forum - Computer Forum - Web Design Forum

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.