diff --git a/src/ng/browser.js b/src/ng/browser.js index f1f80bdfce6f..8d6fa80b9247 100644 --- a/src/ng/browser.js +++ b/src/ng/browser.js @@ -124,7 +124,8 @@ function Browser(window, document, $log, $sniffer) { ////////////////////////////////////////////////////////////// var lastBrowserUrl = location.href, - baseElement = document.find('base'); + baseElement = document.find('base'), + replacedUrl = null; /** * @name ng.$browser#url @@ -159,14 +160,21 @@ function Browser(window, document, $log, $sniffer) { baseElement.attr('href', baseElement.attr('href')); } } else { - if (replace) location.replace(url); - else location.href = url; + if (replace) { + location.replace(url); + replacedUrl = url; + } else { + location.href = url; + replacedUrl = null; + } } return self; // getter } else { - // the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172 - return location.href.replace(/%27/g,"'"); + // - the replacedUrl is a workaround for an IE8-9 issue with location.replace method that doesn't update + // location.href synchronously + // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172 + return replacedUrl || location.href.replace(/%27/g,"'"); } };