Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Commit b249512

Browse files
committed
use pushstate, fall back to window.location.hash.
current implementation does double redirect due to '#!'
1 parent 27d2818 commit b249512

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

modules/core/client/app/init.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,20 @@ angular.module(ApplicationConfiguration.applicationModuleName).run(function ($ro
4646
//Then define the init function for starting up the application
4747
angular.element(document).ready(function () {
4848
//Fixing facebook bug with redirect
49-
if (window.location.hash === '#_=_') {
50-
window.location.hash = '#!';
49+
if (window.location.hash && window.location.hash === '#_=_') {
50+
if (window.history && history.pushState) {
51+
window.history.pushState('', document.title, window.location.pathname);
52+
} else {
53+
// Prevent scrolling by storing the page's current scroll offset
54+
var scroll = {
55+
top: document.body.scrollTop,
56+
left: document.body.scrollLeft
57+
};
58+
window.location.hash = '';
59+
// Restore the scroll offset, should be flicker free
60+
document.body.scrollTop = scroll.top;
61+
document.body.scrollLeft = scroll.left;
62+
}
5163
}
5264

5365
//Then init the app

0 commit comments

Comments
 (0)