Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Javascript/Error reporting

From MoodleDocs
Revision as of 13:22, 14 July 2021 by David Mudrak (talk | contribs) (Text replacement - "class="nicetable"" to "class="wikitable"")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please join the discussion on moodle.org or use the page comments.


This article will act as a guide for users reporting errors related to JavaScript in Moodle.


Overview

Generally, when debugging JavaScript errors in Moodle, we will ask for a number of things. This will likely include some, or all of the following:

  • the content of your JavaScript error log or console;
  • the value of certain settings related to JavaScript;
  • which Moodle add-ons you have enabled;
  • which blocks are visible on the affected page(s); and
  • when you see this issue:
    • are all browsers affected, or just some;
    • are all users affected, or just students, just tutors, just admins, etc;
    • do you see it on all pages, or just some
    • if you're in a course, is it present when editing is enabled and disabled, or just sometimes?
    • if you're in a course, is it on all courses

We understand that it may not always be possible to answer all of these questions and sometimes it is not required, but generally the more information you provide, the easier it is for us to replicate the issue in order to address it.

General guidelines

We may ask you to set some of the following configuration settings within Moodle. These will help to pinpoint errors more easily:

Setting Value Purpose Performance notes
yuicomboloading false This setting causes files which are normally combined to reduce server overhead to be split into multiple files. This will cause a slight increase in the number of requests, but should have little adverse effect on performance.
debug 32767 / DEBUG_DEVELOPER Use of this setting will cause a debugging version of your JavaScript to be loaded which contains additional logging to be output and further information to be shown when displaying errors This will cause an increase in bandwidth utilisation as larger versions of the JavaScript will be sent. Once loaded once, these files are normally cached by the browser for the rest of the login session.
cachejs false Use of this setting will mean that browsers are instructed not to cache the JavaScript. This will cause an increase in the number of requests as every page will cause all JavaScript to be reloaded. We will not normally ask you to change this setting.

Browser-specific guidance

Different browsers have very different tools for debugging these issues. Some have features that others do not have and we may ask you to try in a browser you do not normally use in an attempt to pinpoint an issue.

These are some notes on common things we may ask you to do.

Chrome

Chrome has a particularly powerful set of Developer Tools. The way that you access these may be different depending on your operating system. All versions will generally open the Developer Tools when you press the 'F12' key. Note: You may need to hold down the Fn key on some systems (e.g. Macintosh).

Javascript Console

After opening the Developer Tools, click the 'Console' button at the top of the tool drawer.

Firefox with the Firebug extension

Firefox

Internet Explorer

Safari

Others