Use document.location for makeRelPath

document.baseURI is a string, does not have properties like .host