Skip to content

Instantly share code, notes, and snippets.

@bsparks
Forked from thomseddon/gist:3834721
Created June 28, 2013 20:09
Show Gist options
  • Save bsparks/5887694 to your computer and use it in GitHub Desktop.
Save bsparks/5887694 to your computer and use it in GitHub Desktop.
var buggyAndroid = parseInt((/android (\d+)/.exec(window.navigator.userAgent.toLowerCase()) || [])[1], 10) < 4;
if (!history.pushState || buggyAndroid) {
if (window.location.hash) {
if(window.location.pathname !== '/') window.location.replace('/#!' + window.location.hash.substr(2)); //Hash and a path, just keep the hash (redirect)
} else {
window.location.replace('/#!' + window.location.pathname); //No hash, take path
}
}
//And then in app.config:
//$locationProvider.html5Mode(true).hashPrefix('!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment