Checks whether a string is a URL pointing at a different host than the current page.
In a browser, relative URLs are resolved against the document, so they (and absolute
URLs on the current host) return false. Without a DOM, such as in Node.js, only
absolute URLs with a host return true.
Parameters
str: string
The string to check.
Returns boolean
true if str is a URL with a host other than the current page's.
Checks whether a string is a URL pointing at a different host than the current page.
In a browser, relative URLs are resolved against the document, so they (and absolute URLs on the current host) return
false. Without a DOM, such as in Node.js, only absolute URLs with a host returntrue.