* Returns the current document base URL. * @returns {string}
()
| 21103 | * @returns {string} |
| 21104 | */ |
| 21105 | function getBaseUrl() { |
| 21106 | if (window.document.baseURI) { |
| 21107 | return window.document.baseURI; |
| 21108 | } |
| 21109 | |
| 21110 | // `document.baseURI` is available everywhere except IE |
| 21111 | if (!baseUrlParsingNode) { |
| 21112 | baseUrlParsingNode = window.document.createElement('a'); |
| 21113 | baseUrlParsingNode.href = '.'; |
| 21114 | |
| 21115 | // Work-around for IE bug described in Implementation Notes. The fix in `urlResolve()` is not |
| 21116 | // suitable here because we need to track changes to the base URL. |
| 21117 | baseUrlParsingNode = baseUrlParsingNode.cloneNode(false); |
| 21118 | } |
| 21119 | return baseUrlParsingNode.href; |
| 21120 | } |
| 21121 | |
| 21122 | /** |
| 21123 | * @ngdoc service |
no outgoing calls
no test coverage detected