quirkey / sammy

Sammy is a tiny javascript framework built on top of jQuery, It's RESTful Evented Javascript.
http://sammyjs.org
MIT License
2.99k stars 384 forks source link

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

Open jmasse opened 11 years ago

jmasse commented 11 years ago

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 :-)

japf commented 10 years ago

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

jmasse commented 10 years ago

Ok :-)

Date: Wed, 28 Aug 2013 06:10:04 -0700 From: notifications@github.com To: sammy@noreply.github.com CC: jonathanmasse@hotmail.com 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.

dshoulders commented 10 years ago

Fixed it for me too.

DannyGB commented 9 years ago

Fixed for me too

JohnBergman commented 9 years ago

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.

svenbit commented 9 years ago

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.

igor10k commented 8 years ago

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;
  ...