File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which is quicker

 
Bryce Martin
Ranch Hand
Posts: 269
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Loading JS from an external file or loading it in a <script> tag in the head section of the page?
[ January 21, 2008: Message edited by: Bear Bibeault ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well it depends on what you are doing. Is the extrenal file packed? Are you gzipping things?

The external file will contain the same information only real difference is you need to make another http request to get that information. The external file will get cached so it will be faster on multiple hits. That is where he benefit is.

Eric
 
Bryce Martin
Ranch Hand
Posts: 269
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I want to create a dynamic Search Results Page. And the information that is displayed as header information vs being put in the table is based on the criteria the user searches by. Right now there are 7 different combinations for the user to search by. I'm thinking this could get my javascript to be pretty long if I'm trying to write different jQuery code for each example. So I though about packaging it up in an external file and break it all down into classes based on the criteria. Then just call the classes I need.

Sound like a good candidate for external JS file that is gzipped? This would be dom manipulation and jqGrid creation. Basically I will have a couple of divs that I'll ID and then do my changes to them.

I think I've talked myself into doing most of it external.

If you have any thoughts please let me know...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic