};
HTMLArea.prototype.stripBaseURL = function(string) {
+ var baseurl = this.config.baseURL;
// IE adds the path to an anchor, converting #anchor
// to path/#anchor which of course needs to be fixed
var index = string.indexOf("/#")+1;
- if (index > 0) {
+ if ((index > 0) && (string.indexOf(baseurl) > -1)) {
return string.substr(index);
}
return string; // Moodle doesn't use the code below because
// Moodle likes to keep absolute links
-
- var baseurl = this.config.baseURL;
+
// strip to last directory in case baseurl points to a file
baseurl = baseurl.replace(/[^\/]+$/, '');
var basere = new RegExp(baseurl);