This tutorial will guide a FIM/MIM administrator on the steps required to introduce a custom JavaScript file and dependency reference into the FIM/MIM default master page.

You may be wondering why you might want to accomplish this goal. These include:

  • Adding custom page on-load events
  • Creating custom targets for Home Page and Navigation Bar Resources

There are three stages to this tutorial:-

  • Create the custom.js file
  • Modify the ilm2.master file
  • Test the solution with a basic alert pop-up

1) Navigate to C:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\TEMPLATE\LAYOUTS

2) Create an empty file called custom.js and add the content below:-

Note: This is a sample JavaScript line and should be removed after a succesful test.

// Custom JavaScript
alert("modification has worked");

add custom js 1

3) Navigate to C:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\TEMPLATE\FEATURES\MSILM2MasterPage

add custom js 2

4) Edit the ilm2.master file with notepad and add the following line as shown in the image below:-

<SharePoint:ScriptLink ID="ScriptLink2" language="javascript" name="custom.js" Defer="true" runat="server"/>

Note: Ensure you take a backup of the ilm2.master file as a matter of best practice.

add custom js 3

5) Refresh your FIM/MIM web page and you should see the pop up as shown below.

add custom js 4

Note:- You should comment out this line in the custom.js file when you are satisfied the tutorial has worked.

add custom js 5