When dealing with SharePoint, I’ve found that I like to keep all my scripts in a single directory, both because it’s clean and it helps to separate out the site wide scripts from other files on the site. However, once you’ve created your scripts library, often times you don’t want the average user poking around inside these directories. By hiding a scripts library from the browser you can keep your site secure (ish). There’s no way around poorly written code, but at least you’re not putting out the welcome mat and allowing browser access. Hiding the library allows you to prevent the casual inquisitive eyes from wandering through your script code.

1. Create a document library in the root of your web application. Use the document template of none.

2. Your naming convention for this library should be something simple. I use /Scripts but you can name it anything like. Just be consistent as you’ll always want to have a standard to make your pages somewhat portable from one site to the next.

3. Once the library is created you want to hide it from the browser, this option just eliminates the browser navigation. If you know the URL it can still be accessed through the browser, just hidden from normal navigation. You always have access to it through SharePoint Designer (SPD).

To hide from browser open your site in SharePoint Designer

  • Right click on your Script library
  • Select Properties
  • On the Settings tab, select Hide from browsers

clip_image001

This library can no longer be accessed through the browser SharePoint interface.