* Returns the current document base URL. * @returns {string}
()
| 21889 | * @returns {string} |
| 21890 | */ |
| 21891 | function getBaseUrl() { |
| 21892 | if (window.document.baseURI) { |
| 21893 | return window.document.baseURI; |
| 21894 | } |
| 21895 | |
| 21896 | // `document.baseURI` is available everywhere except IE |
| 21897 | if (!baseUrlParsingNode) { |
| 21898 | baseUrlParsingNode = window.document.createElement('a'); |
| 21899 | baseUrlParsingNode.href = '.'; |
| 21900 | |
| 21901 | // Work-around for IE bug described in Implementation Notes. The fix in `urlResolve()` is not |
| 21902 | // suitable here because we need to track changes to the base URL. |
| 21903 | baseUrlParsingNode = baseUrlParsingNode.cloneNode(false); |
| 21904 | } |
| 21905 | return baseUrlParsingNode.href; |
| 21906 | } |
| 21907 | |
| 21908 | /** |
| 21909 | * @ngdoc service |
no outgoing calls
no test coverage detected