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

Commit

Permalink
use pushstate, fall back to window.location.hash.
Browse files Browse the repository at this point in the history
current implementation does double redirect due to '#!'
  • Loading branch information
rhutchison committed Aug 23, 2015
1 parent 27d2818 commit b249512
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions modules/core/client/app/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,20 @@ angular.module(ApplicationConfiguration.applicationModuleName).run(function ($ro
//Then define the init function for starting up the application
angular.element(document).ready(function () {
//Fixing facebook bug with redirect
if (window.location.hash === '#_=_') {
window.location.hash = '#!';
if (window.location.hash && window.location.hash === '#_=_') {
if (window.history && history.pushState) {
window.history.pushState('', document.title, window.location.pathname);
} else {
// Prevent scrolling by storing the page's current scroll offset
var scroll = {
top: document.body.scrollTop,
left: document.body.scrollLeft
};
window.location.hash = '';
// Restore the scroll offset, should be flicker free
document.body.scrollTop = scroll.top;
document.body.scrollLeft = scroll.left;
}
}

//Then init the app
Expand Down

0 comments on commit b249512

Please sign in to comment.