Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Place javascript files in 12 Hive or in Document Library?

Besides the obvious benefit of placing the custom javascript files (or any other resource files) in a document library, such as:

  • versioning, history, tracking
  • easy to change/edit

Is there any other benefits?

Performance? Page Load time?

Are there any cons?

PS. This is not meant as a question on number of files / resources has a general HTTP performance, but rather this specific SharePoint issue on the file location.

http://site/_layouts/myjavascript.js

vs.

http://site/DocumentLibrary/myjavascript.js
like image 878
Magnus Johansson Avatar asked Feb 28 '23 04:02

Magnus Johansson


2 Answers

If you are storing the javascript in a library then it is stored in the database.

It means that:

  1. It has version control

  2. It is slower then the filesystem (unless you are using blob cache)

  3. It will be included in any backups you do of your sharepoint install (stsadm for example)

  4. It will be accessible (changeable) by anyone with access to the document library (easier to maintain, less secure)

  5. Client side caching will behave differently (you'll need to configure it, it's a bit complicated for MOSS content vs filesystem content)

We decided to store it in the 12 hive as it feels better in regards to code vs. data separation. If you consider this file to be data then store it in MOSS, if you consider it to be "code" then store it in the filesystem.

like image 189
Nir Levy Avatar answered Mar 08 '23 14:03

Nir Levy


have you considered using google to host javascript files (such as jquery)

  • this benefits from using their bandwidth for downloading the files
  • faster page loading times
  • higher availability
  • chances are high that your javascript file is already cached on the user's machine
like image 38
Rob Avatar answered Mar 08 '23 14:03

Rob