* 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)
| 21877 | * @returns {boolean} - True if both URLs have the same origin, and false otherwise. |
| 21878 | */ |
| 21879 | function urlsAreSameOrigin(url1, url2) { |
| 21880 | url1 = urlResolve(url1); |
| 21881 | url2 = urlResolve(url2); |
| 21882 | |
| 21883 | return (url1.protocol === url2.protocol && |
| 21884 | url1.host === url2.host); |
| 21885 | } |
| 21886 | |
| 21887 | /** |
| 21888 | * Returns the current document base URL. |
no test coverage detected