External Javascript File and FP Interactive Buttons (help pls)

M

Margaret

It seems there is a lot of javascript generated by FP when using Interactive
Buttons. Has anyone ever tried to pull all the js code out and into an
external file, and been successful at it? If so, any suggestions how to do it
"properly / effectively"??

I ask, as I understand making it an external file can speed up the
page-loading process. Some of the visitors to the web pages I'm creating may
have lower bandwidths, including 56K modems. Is this right?

Thanks.

Margaret
 
K

Kevin Spencer

Hi Margaret,
I ask, as I understand making it an external file can speed up the
page-loading process. Some of the visitors to the web pages I'm creating
may
have lower bandwidths, including 56K modems. Is this right?

Good question. Let me explain. Anything the browser doesn't have cached will
have to be downloaded from the server. This includes JavaScript, CSS, and
yes, HTML. So, if you are using the same JavaScript in numerous pages, it
can improve download time slightly to put it into an external .js file. Note
that I said "slightly." Why? Because JavaScript is text. Text is pretty
lightweight. One image in a page can outweigh all the HTML in it in many
cases. So, things like images and other binary material are the main thing
to watch out for.

The reason I say this is that it will be a royal pain to try to do this with
most FrontPage-generated stuff. And your page probably has more text in the
form of in-line tags etc. I believe the next version of FrontPage will do
more external formatting stuff, especially CSS, which is much better to use
for formatting than HTML tags.

So, if I were you I wouldn't worry about a little JavaScript here and there.
See how well you can optimize your images and other binary materials
instead.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.
 
R

Ronx

It can be done, but can involve a lot of work.
The JavaScript in the <head> section must be copied into the external
..js file, and the function names must be changed.
In the page(s) all the function calls in the button tags must be
changed to match the renamed functions in the .js file. If the
functions are not renamed FrontPage will replace the code in the
<head> section if you delete it.
Finally, delete the javascript from the <head> section, and link the
..js file to the page:
In the <head> add
<script type="text/javascript" src="path/to/myscript.js"></script>

This must be done on all pages using the external .js file.

The first page loaded by the user will take slightly longer to load -
there is an extra file to fetch. However, subsequent pages will take
slightly less time to load - the extra file will be loaded from the
browser's cache. The overall saving in time is minimal, even on
dialup, and probably not worth the effort unless there is a lot more
in the .js file than just the code for interactive buttons.
 
S

Stefan B Rusynko

PS
In addition the BODY onload= needs to be removed and replaced w/ your own image preload script




| It can be done, but can involve a lot of work.
| The JavaScript in the <head> section must be copied into the external
| .js file, and the function names must be changed.
| In the page(s) all the function calls in the button tags must be
| changed to match the renamed functions in the .js file. If the
| functions are not renamed FrontPage will replace the code in the
| <head> section if you delete it.
| Finally, delete the javascript from the <head> section, and link the
| .js file to the page:
| In the <head> add
| <script type="text/javascript" src="path/to/myscript.js"></script>
|
| This must be done on all pages using the external .js file.
|
| The first page loaded by the user will take slightly longer to load -
| there is an extra file to fetch. However, subsequent pages will take
| slightly less time to load - the extra file will be loaded from the
| browser's cache. The overall saving in time is minimal, even on
| dialup, and probably not worth the effort unless there is a lot more
| in the .js file than just the code for interactive buttons.
| --
| Ron Symonds
| Microsoft MVP (FrontPage)
| Reply only to group - emails will be deleted unread.
|
| | > It seems there is a lot of javascript generated by FP when using
| > Interactive
| > Buttons. Has anyone ever tried to pull all the js code out and into
| > an
| > external file, and been successful at it? If so, any suggestions how
| > to do it
| > "properly / effectively"??
| >
| > I ask, as I understand making it an external file can speed up the
| > page-loading process. Some of the visitors to the web pages I'm
| > creating may
| > have lower bandwidths, including 56K modems. Is this right?
| >
| > Thanks.
| >
| > Margaret
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top