* Determine if two URLs share the same origin. * * @param {string|Object} url1 - First URL to compare as a string or a normalized URL in the form of * a dictionary object returned by `urlResolve()`. * @param {string|object} url2 - Second URL to compare as a string or a normalized URL in the
(url1, url2)
| 21091 | * @returns {boolean} - True if both URLs have the same origin, and false otherwise. |
| 21092 | */ |
| 21093 | function urlsAreSameOrigin(url1, url2) { |
| 21094 | url1 = urlResolve(url1); |
| 21095 | url2 = urlResolve(url2); |
| 21096 | |
| 21097 | return (url1.protocol === url2.protocol && |
| 21098 | url1.host === url2.host); |
| 21099 | } |
| 21100 | |
| 21101 | /** |
| 21102 | * Returns the current document base URL. |
no test coverage detected