var base = document.getElementsByTagName('base')[0].href;