Skip to content

IE11 bookmark does not work when clicked twice #1241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PremekPan opened this issue Aug 1, 2014 · 2 comments
Closed

IE11 bookmark does not work when clicked twice #1241

PremekPan opened this issue Aug 1, 2014 · 2 comments

Comments

@PremekPan
Copy link

On IE11 after you open application from bookmark, change state and open the same bookmark again than nothing happens. I'd like to attach very simple zip which demonstrates that but zip files are not supported, so here is example code and steps to reproduce:

  1. First, create very simple application: index.html, state1.html, state2.html, app.js (routing configuration). Sources are provided at the end of description.

  2. Create bookmark in IE11:

http://localhost/ang_app/index.html#/1
  1. Start new IE11 session, start application via bookmark created at step 2.
    step1

  2. Click on link 'State 2' and observe that application changes it's state as expected.

step2

  1. Click ON BOOKMARK that you created in step 2 again. Observe application behavior: URL hash changed to '1' but application state does not reflect the change and stays in state '2'.

step3

index.html:

<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script src="angular.js"></script>
<script src="angular-ui-router.js"></script>
<script src="app.js"></script>
</head>
<body>
    <div ui-view></div>
    <a href="#/1">State 1</a>
    <a href="#/2">State 2</a>
</body>
</html>

state1.html:

<h1>State 1</h1>

state2.html:

<h1>State 2</h1>

app.js:

var myApp = angular.module('myApp', ['ui.router']);

myApp.config(function($stateProvider, $urlRouterProvider) {
  //
  // For any unmatched url, redirect to /state1
  $urlRouterProvider.otherwise("/state1");
  //
  // Now set up the states
  $stateProvider
    .state('1', {
      url: "/1",
      templateUrl: "state1.html"
    })
    .state('2', {
      url: "/2",
      templateUrl: "state2.html"
    })
    });

Additional info:

angular: v1.2.19
ui-router: v0.2.10
Windows 8.1
IE11:

ie_info

Any help will be appreciated!

@tspaeth
Copy link

tspaeth commented Sep 17, 2014

Hi!

I also ran into this problem, but this is not an issue of ui-router (it is reproducible also with the standard AngularJS-router features). It is more or less how AngularJS currently detects the hashChanges or - other way around - how Internet Explorer behaves when clicking on a bookmark twice.

If you introduce a manual "watcher" / "poller" into your app as plain Javascript, you can see that somehow a change CAN be detected. But the window.onhashchange is not triggered in IE10/IE11 unfortunately.

Therefore it is a complex issue at the end to whoever feels responsible - AngularJS with a dirty poll fix or Microsoft with a fix to the handling. But a Microsoft - Fix won't help to be backwards compatible...

        var previousHash = window.location.hash;
        window.setInterval(function () {
            if (window.location.hash !== previousHash) {
                previousHash = window.location.hash;
                console.log('new URL:', window.location.hash);
            }
        }, 500);

I'm thinking about a solution currently, but haven't been implementing something.

@eddiemonge
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants