code: function(path) {
    var loc = window.location;
  
    if (path[path.length-1] === '/') {
      path = path.slice(0, -1);
    }
  
    if (~path.indexOf('//')) { 
      return path;
    }
  
    var auth = /^[^:\/]+:\/\/[^\/]+/.exec(loc.href)[0];
  
    if (path[0] === '/') {
      path = auth + path;
    } else {
      path = path.replace(/^\.?\//, '');
      loc = loc.pathname.replace(/^\/|\/$/g, '');
      path = [auth, loc, path].join('/');
    }
  
    return path;
  }
docs: XXX this needs cleaning, add a parsePath method