Click to See Complete Forum and Search --> : which performs better?


stepheno
10-22-2003, 09:45 PM
Which performs better, including javascript code via the:

<script language="JavaScript" src="bla/bla/bla.js"></script>

or the

<jsp:include page="bla/bla.jsp">

method? Can anyone give me a reason to use one or the other?

fredmv
10-22-2003, 10:04 PM
It looks to me like one includes an external JavaScript file, whereas the other includes an external Java Server Page file. You can't really accurately compare the two.

stepheno
10-23-2003, 06:25 AM
I've seen javascript included using the

<jsp:include page="bla/bla.jsp">

method where the bla/bla.jsp was a file just containing javascript within the <script> tags. This is why I am wondering if the first way might be better. Or maybe there is a standard that states how javascript should be included?

Charles
10-23-2003, 06:38 AM
<script type="text/javascript" src="bla/bla/bla.js"></script>

Requires a second HTTP request which means it will take a little longer to download the first time but once it is in the user's cache it won't need to be re-sent. More importantly, users who are not using JavaScript will not have to download your script at all - saving you and the user bandwith, time and possibly money.

stepheno
10-23-2003, 09:10 PM
Thanks for the feedback.