In the case that the url passed to swagger-js is relative, if `window` is available, we should use `window.origin`.