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.

1
  • Have you seen my answer? Do you find it helpful? Commented Jan 1, 2014 at 1:26

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Does this really work? Won't all of the URLs have hashes in them?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.