Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Add JavaScript to Administrative Area

Go to End

4 Posts   2997 Views


Community Member, 16 Posts

12 July 2010 at 10:54pm

This code adds my custom JavaScript to BOTH the administrative area AND the public website:

// from mysite/code/page.php
function getCMSFields() {
Requirements::javascript( 'mysite/javascript/custumL.js ' );

I only want to add the JavaScript to the administrative area. It should NOT be loaded on the public website.


Forum Moderator, 5523 Posts

13 July 2010 at 4:36pm

Use this in your _config file


LeftAndMain is the class which handles the CMS. Though unless you call getCMSFields() on the front end of the site it shouldn't include any JS from that function.


Community Member, 16 Posts

14 July 2010 at 9:24am



Community Member, 56 Posts

28 February 2012 at 3:26am

Is this still working in 2.46?
I tried it without success....