vojtech-dobes / nette.ajax.js

Flexible AJAX for Nette Framework. Supports snippets, redirects etc.
https://componette.org/vojtech-dobes/nette.ajax.js/
MIT License
149 stars 85 forks source link

WebKit initial request fix obstructs returning back to initial page #82

Closed VojtaSim closed 10 years ago

VojtaSim commented 10 years ago

After testing history extension for nette.ajax.js I've encountered an unwanted feature in fix discussed here: https://github.com/vojtech-dobes/nette.ajax.js/issues/73. When I click through some sections the plugin works just fine but when I navigate back through those sections I'm not able to load the initial page. This part of 'popstate' handler is suspicious:

var initialPop = (popped && initialUrl == state.href);
// console.log('popped: ' + popped + '\ninitialUrl: ' + initialUrl + '\nstate.href: ' + state.href);
popped = true;
if (initialPop) {
    return;
}

https://github.com/vojtech-dobes/nette.ajax.js/blob/master/history/history.ajax.js#L45

Explained:

My solution would be to add another variable containing true/false indication whether user has already loaded another page or not.