Buzzzzzzz
Buzzzzzzz

Reputation: 1214

Moodle, how to add a custom jQuery script to exercute on all pages

I am new to moodle. I have a requirement to run a js every time a user clicks on a download file or watch a video. I don't know where or how to add these files.

I have seen how $page is used.

But is there a global location, like the, master page in .net?

Upvotes: 0

Views: 3016

Answers (1)

Sonil Gandhi
Sonil Gandhi

Reputation: 179

You can create a new js file in your Moodle theme folder.

Path to create new js file

theme->your_theme_folder->javascript-> create new js file here.

Now include your js file in your_theme_folder->config.php like below code

$THEME->javascripts_footer = array('modernizr');

Then you have to purge all cache in Moodle by going to

Site Administration->Development->Purge all caches

That's it your js code will work on all page

Upvotes: 2

Related Questions