Use window.location's origin if passed a relative path