Skip to content

Commit 9eccc73

Browse files
author
Mike Taylor
committed
Issue #569 - Actually fix the bug this time.
1 parent 41a29bb commit 9eccc73

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

webcompat/static/js/lib/issues.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,15 @@ issues.TitleView = Backbone.View.extend({
3131
location.origin = location.protocol + '//' + location.host;
3232
}
3333

34-
// Only go back in history if we came from the /issues page.
35-
if (document.referrer.indexOf(location.origin + '/issues') === 0) {
34+
// Only go back in history if we came from the /issues page and there's
35+
// actually some history to go back to
36+
if ((document.referrer.indexOf(location.origin + '/issues') === 0) &&
37+
(history.length !== 1)) {
3638
history.back();
37-
// If there's nothing to go back to (link opened in new tab, for example)
38-
// just go back to /issues.
39-
} else if (history.length === 1) {
40-
window.location = '/issues';
39+
e.preventDefault();
40+
} else {
41+
location.href = '/issues';
4142
}
42-
43-
e.preventDefault();
4443
}
4544
});
4645

0 commit comments

Comments
 (0)