Tag Archives: core.js sharepoint

Customize or Override core.js file functions in Sharepoint


Core.js JScript file located @ 12 or 14 hive , depending upon the SharePoint version installed on a system, provides several in-built javascript functions. This is an out-of-box aka OOB sharepoint file.
[12/14 hive is @ %PROGRAMFILES%\Common Files\Microsoft Shared\Web Server Extensions\]

These functions are invoked internally by OOB visual webparts in sharepoint.

For e.g.,
Any Document library View page listing all items, hosted in a sharepoint site, references core.js file. Functions may get invoked when a user hovers any item name column or when an Add New Item link is clicked.

You may be thinking about the scenarios where you may need to customize a function defined in core.js file.

Where\Why?
There can be many. Yes. One of them which i faced is related to Browser compatibility.

  • Add modal pop up opening as a full page
  • On XP SP3 build’ IE7, a javascript error was thrown on clicking “Add New Item”. Due to this, an AddItem page was opening as a full page rather than a modal pop-up. This was not even reproducible on IE9 running into IE7 compatibilty and document mode.
    The faulty function was: function UseDialogsForFormsPages(c){…}

    You may face other problems but cause could be the same.

Note: However, my recommendation is NOT to OVERWRITE the core.js.

You may now be confused. Many questions may be coming into your mind – What is the purpose of this blog then?, How should i achieve if i ever need to?

Well, i recommended not to overwrite core.js. The reason being that this is OOB file and may get modified in the next version of sharepoint.
What you should do is provide a method override. Another javascript function which has a same prototype but a body definition as per your requirements.
Continue reading Customize or Override core.js file functions in Sharepoint

Advertisements