473,322 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Include Scripts

Hello,

I am working on a web site where I have a master page.
Most web site pages use this master page as base.

Some scripts are used in all pages ... other just in a few pages.
Should I load all scripts in master page ... I think they are cached
right?

Or should I load the common scripts to all pages in my master page and
then in each page load the scripts that are not used in all pages?

Thanks,
Miguel
Aug 17 '08 #1
3 1392
In general, I prefer an "as needed" approach, which would mean only the
scripts that belong in all pages go in the main master. This will add a bit
more work in setting up the pages, but will prevent overloading your users.

If your pages are easily segmented, you can use a master page hierarchy and
add scripts as needed, but this could be a maintenance nightmare.

Putting all in one master is the easiest option, from your side. But, if
your users are on a slow connection, it could be a nightmare for them, as
all the scripts have to be downloaded to get things working.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"shapper" <md*****@gmail.comwrote in message
news:a5**********************************@m45g2000 hsb.googlegroups.com...
Hello,

I am working on a web site where I have a master page.
Most web site pages use this master page as base.

Some scripts are used in all pages ... other just in a few pages.
Should I load all scripts in master page ... I think they are cached
right?

Or should I load the common scripts to all pages in my master page and
then in each page load the scripts that are not used in all pages?

Thanks,
Miguel
Aug 17 '08 #2
On Aug 17, 11:56*pm, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamMwrote:
In general, I prefer an "as needed" approach, which would mean only the
scripts that belong in all pages go in the main master. This will add a bit
more work in setting up the pages, but will prevent overloading your users.

If your pages are easily segmented, you can use a master page hierarchy and
add scripts as needed, but this could be a maintenance nightmare.

Putting all in one master is the easiest option, from your side. But, if
your users are on a slow connection, it could be a nightmare for them, as
all the scripts have to be downloaded to get things working.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my bloghttp://feeds.feedburner.com/GregoryBeamer#

or just read it:http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! * * * * * * * * * * * * * * * |
********************************************"shapp er" <mdmo...@gmail.com>wrote in message

news:a5**********************************@m45g2000 hsb.googlegroups.com...
Hello,
I am working on a web site where I have a master page.
Most web site pages use this master page as base.
Some scripts are used in all pages ... other just in a few pages.
Should I load all scripts in master page ... I think they are cached
right?
Or should I load the common scripts to all pages in my master page and
then in each page load the scripts that are not used in all pages?
Thanks,
Miguel
Is there any tool that merges various Javascript files into one single
file and minifies it?

I suppose that would be the best solution. Then I would use that file
on production mode ...

Thanks,
Miguel
Aug 18 '08 #3

"shapper" <md*****@gmail.comwrote in message
news:45**********************************@x35g2000 hsb.googlegroups.com...
On Aug 17, 11:56 pm, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamMwrote:
>
Is there any tool that merges various Javascript files into one single
file and minifies it?
None that I know of. Combining the files should not be hard. To make it as
small as possible, you can create a small tool that reads each line and
removes the carriage returns along with any spaces larger than one space.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************

Aug 18 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Rob Long | last post by:
Hey, I've written a custom HTML library using many PHP scripts as seperate files (just like I'd do a java project) and I'm having some problems where I'm including scripts in different...
43
by: steve | last post by:
I am quite frustrated with php’s include, as I have spent a ton of time on it already... anyone can tell me why it was designed like this (or something I don’t get)? The path in include is...
9
by: Tom Cat | last post by:
Is there anything wrong with using a lot of include files? On one part of my website, I have a form. The page it posts data to, includes a different file based on some of the values. The...
3
by: Michael | last post by:
There seem to be two ways to include files on the server: 1. <!-- #include file="header.inc" --> 2. <script language="VBScript" runat="server" src="header.inc"></script> What are the differences...
5
by: Bill | last post by:
I have perhaps not explained myself clearly, so I'll try it this way. In the code below, where it says "I'd like to include my navigation bar here" is the place I'd like to insert a navigation bar...
0
by: Tom Bates | last post by:
Can I include the same include files in global.asa that I use in other ..asp scripts? I haven't been able to make it work. My O'Reilly book says that global.asa can have includes, but the syntax...
4
by: Cracker Jacks | last post by:
I am having trouble pointing an ASP file to another ASP for use in the include statement. I do not understand all the different paths that the server or the scripts use. Could someone please...
2
by: Keith Chadwick | last post by:
I have been running some tests with regards to xsl:include and xsl:import with the same results on both and I am wondering if someone can explain this behavior to me! First off the xslt file is...
11
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package...
7
by: berkshire | last post by:
We recently upgraded php from 4.3.9 to 4.4.7. Everything is working well, except the php scripts running as cronjobs. It appears the problem is that these scripts utilize the include() function...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.