3

I have an application with html5Mode = true, but on IE I don't need to fallback to a #/url. What I need is to keep the URL and make a complete page reload.

If I don't find any way, I will need to edit the AngularJS file, and that is what I don't want.

Suggestions?

Thanks!

-- EDIT --

As a temporal solution I commented some code in the AngularJS file.

/*if ($sniffer.history) {*/
    $location = new LocationUrl(
      convertToHtml5Url(initUrl, basePath, hashPrefix),
      pathPrefix, appBaseUrl);
  /*} else {
    $location = new LocationHashbangInHtml5Url(
      convertToHashbangUrl(initUrl, basePath, hashPrefix),
      hashPrefix, appBaseUrl, basePath.substr(pathPrefix.length + 1));
  }*/

Now it doesn't fall back to Hashtag urls, and the Browser.url make a location.href if the browser doesn't support the history API.

Diestrin
  • 294
  • 1
  • 4
  • 11

1 Answers1

0

I think this does what you want. If not, perhaps the solution involves the same event $locationChangeStart.

  var gate = 1;
  $scope.$on("$locationChangeStart", function(event, nextLocation, currentLocation) {
    if ($('html').is('.ie6, .ie7, .ie8')) {
      if (gate === 0) { //prevent endless location change
        gate = 1;
        window.location.href = nextLocation; //reload the page
      }
      else {
        gate = 0;
      }
    }
  });

In case you're unaware of this OldIE check, see this post.

Community
  • 1
  • 1
m59
  • 43,214
  • 14
  • 119
  • 136