Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-50456

url.relativeUrl is not working

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.9.1
    • 2.9, 3.0
    • JavaScript
    • MOODLE_29_STABLE, MOODLE_30_STABLE
    • MOODLE_29_STABLE
    • MDL-50456-master
    • Hide

      Add this code to the bottom of admin/index.php

      (Immediately after the call to admin_externalpage_setup)

      $PAGE->requires->js_amd_inline('
          require(["core/url"], function(url) {
              console.log(url.relativeUrl("/admin/index.php"));
          });
      ');
      

      Go to admin/index.php

      Check your JS console and you should see the full url of the current page.

      You should not see:

      Error: relativeUrl function does not accept absolute urls

      Show
      Add this code to the bottom of admin/index.php (Immediately after the call to admin_externalpage_setup) $PAGE->requires->js_amd_inline(' require(["core/url"], function(url) { console.log(url.relativeUrl("/admin/index.php")); }); '); Go to admin/index.php Check your JS console and you should see the full url of the current page. You should not see: Error: relativeUrl function does not accept absolute urls

      The following JS does not work (and it should).

      require(['core/url'], function(url)

      { console.log(url.relativeUrl('/admin/index.php')); }

      );

            damyon Damyon Wiese
            damyon Damyon Wiese
            Dave Cooper Dave Cooper
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Mark Nelson Mark Nelson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.