sammy icon indicating copy to clipboard operation
sammy copied to clipboard

IE10 problem -> Sometime the callback from jquery (location onhashchange is not called)

Open jmasse opened this issue 11 years ago • 7 comments

To repair this issue on IE10 i have this workaround.

I added window.location.hash = new_location; at line : 347.

    // HTML5 History exists and new_location is a full path
    window.location.hash = new_location;
    if (_has_history && !this.app.disable_push_state && /^\//.test(new_location)) {
      history.pushState({ path: new_location }, window.title, new_location);
      this.app.trigger('location-changed');
    } else {
        return (window.location = new_location);
    }

After that, the callback is working perfectly :-)

jmasse avatar May 13 '13 12:05 jmasse

I had the same issue, your hack seems to fix the problem for me.

japf avatar Aug 28 '13 13:08 japf

Ok :-)

Date: Wed, 28 Aug 2013 06:10:04 -0700 From: [email protected] To: [email protected] CC: [email protected] Subject: Re: [sammy] IE10 problem -> Sometime the callback from jquery (location onhashchange is not called) (#193)

I had the same issue, your hack seems to fix the problem for me.

— Reply to this email directly or view it on GitHub.

jmasse avatar Aug 29 '13 16:08 jmasse

Fixed it for me too.

dshoulders avatar Nov 27 '13 14:11 dshoulders

Fixed for me too

DannyGB avatar Jul 11 '14 11:07 DannyGB

I had this problem problem in IE11 with Sammy 0.7.5 and Jquery 1.11.1. This Hack appears to have fixed the issue for me as well.

In my case the issue starts happening when someone refreshes the page, from that point on any window.location.href calls simply set the Url, but do not trigger any Sammy events.

JohnBergman avatar Oct 08 '14 22:10 JohnBergman

Encountered the same issue in IE11 and IE10 with Sammy 0.7.6 an jQuery 1.11.2. This fix seems to have fixed the issue for me as well. Thanks for posting.

svenbit avatar Apr 15 '15 15:04 svenbit

What an awful hack. The same could be achieved by dropping everything related to the HTML5 history.

// HTML5 History exists and new_location is a full path
// if (_has_history && !this.app.disable_push_state && /^\//.test(new_location)) {
//   history.pushState({ path: new_location }, window.title, new_location);
//   this.app.trigger('location-changed');
// } else {
    return (window.location = new_location);
// }

but a much cleaner way to get the same result is to set disable_push_state to true for your routes.

Sammy('body', function () {
  this.disable_push_state = true;
  ...

igor10k avatar Aug 02 '15 23:08 igor10k