When working with JavaScript Client Object Model developers often need to debug the scripts in the browser. By default they are minified, which makes them almost impossible to understand and work with.

The installation of SharePoint comes with two versions of each of its script files such as sp.js and sp.debug.js – the debug versions of the files contain the unminified code.

These files can be found at

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS

Solution

SharePoint has an option, which loads the debug versions of its scripts rather than the minified version.

In order to  set this property, go to

C:\inetpub\wwwroot\wss\VirtualDirectories

Open the folder with number corresponding to the port at which SharePoint is running.

Locate web.config and open it to find the following line

<compilation batch="false" debug="false">

Replace it with

<compilation batch="false" debug="true">

After this step I use

iisreset

in Command Prompt to restart SharePoint and apply the debug setting.

Edit:
You can add

<deployment retail="false" />

to the <system.web> section of the web.config file – Client Object Model Distribution and Deployment.

SharePoint's debug scripts shown in Firebug.
Categories: SharePoint

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *