Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit b99f65f

Browse files
committed
bug(html5 navigation): broken in Opera
http://my.opera.com/community/forums/topic.dml?id=1185462 Closes# 938
1 parent f764748 commit b99f65f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/ng/browser.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ function Browser(window, document, $log, $sniffer) {
123123
// URL API
124124
//////////////////////////////////////////////////////////////
125125

126-
var lastBrowserUrl = location.href;
126+
var lastBrowserUrl = location.href,
127+
baseElement = document.find('base');
127128

128129
/**
129130
* @ngdoc method
@@ -152,7 +153,11 @@ function Browser(window, document, $log, $sniffer) {
152153
lastBrowserUrl = url;
153154
if ($sniffer.history) {
154155
if (replace) history.replaceState(null, '', url);
155-
else history.pushState(null, '', url);
156+
else {
157+
history.pushState(null, '', url);
158+
// Crazy Opera Bug: http://my.opera.com/community/forums/topic.dml?id=1185462
159+
baseElement.attr('href', baseElement.attr('href'));
160+
}
156161
} else {
157162
if (replace) location.replace(url);
158163
else location.href = url;
@@ -231,7 +236,7 @@ function Browser(window, document, $log, $sniffer) {
231236
* @returns {string=}
232237
*/
233238
self.baseHref = function() {
234-
var href = document.find('base').attr('href');
239+
var href = baseElement.attr('href');
235240
return href ? href.replace(/^https?\:\/\/[^\/]*/, '') : href;
236241
};
237242

0 commit comments

Comments
 (0)