code: function (uri) {
          var self = this, output;
  
          if (uri === "./") {
            return uri;
          }
  
          uri = new URI(uri, { base_uri: self });
  
          // Not on same domain/port or protocol
          if ((uri.host != 'mce_host' && self.host != uri.host && uri.host) || self.port != uri.port ||
            (self.protocol != uri.protocol && uri.protocol !== "")) {
            return uri.getURI();
          }
  
          var tu = self.getURI(), uu = uri.getURI();
  
          // Allow usage of the base_uri when relative_urls = true
          if (tu == uu || (tu.charAt(tu.length - 1) == "/" && tu.substr(0, tu.length - 1) == uu)) {
            return tu;
          }
  
          output = self.toRelPath(self.path, uri.path);
  
          // Add query
          if (uri.query) {
            output += '?' + uri.query;
          }
  
          // Add anchor
          if (uri.anchor) {
            output += '#' + uri.anchor;
          }
  
          return output;
        }
docs: Converts the specified URI into a relative URI based on the current URI instance location.
  
  @method toRelative
  @param {String} uri URI to convert into a relative path/URI.
  @return {String} Relative URI from the point specified in the current URI instance.
  @example
  // Converts an absolute URL to an relative URL url will be somedir/somefile.htm
  var url = new tinymce.util.URI('http://www.site.com/dir/').toRelative('http://www.site.com/dir/somedir/somefile.htm');