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

Commit

Permalink
bug(html5 navigation): broken in Opera
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery committed May 7, 2012
1 parent f764748 commit b99f65f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/ng/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ function Browser(window, document, $log, $sniffer) {
// URL API
//////////////////////////////////////////////////////////////

var lastBrowserUrl = location.href;
var lastBrowserUrl = location.href,
baseElement = document.find('base');

/**
* @ngdoc method
Expand Down Expand Up @@ -152,7 +153,11 @@ function Browser(window, document, $log, $sniffer) {
lastBrowserUrl = url;
if ($sniffer.history) {
if (replace) history.replaceState(null, '', url);
else history.pushState(null, '', url);
else {
history.pushState(null, '', url);
// Crazy Opera Bug: http://my.opera.com/community/forums/topic.dml?id=1185462
baseElement.attr('href', baseElement.attr('href'));
}
} else {
if (replace) location.replace(url);
else location.href = url;
Expand Down Expand Up @@ -231,7 +236,7 @@ function Browser(window, document, $log, $sniffer) {
* @returns {string=}
*/
self.baseHref = function() {
var href = document.find('base').attr('href');
var href = baseElement.attr('href');
return href ? href.replace(/^https?\:\/\/[^\/]*/, '') : href;
};

Expand Down

0 comments on commit b99f65f

Please sign in to comment.