-
Notifications
You must be signed in to change notification settings - Fork 65
browser back button #50
Comments
Same here. Back button doesn't seem to be firing my It looks like the issue is caused by the fact that when the back button is used turbolinks only fires:
but jquery.turbolinks is only listening for:
When a page is first loaded that uses turbolinks it seems to fire:
@kossnocorp any suggestions how this could be resolved? |
@sandrodz this worked for me turbolinks/turbolinks-classic#533 (comment) |
hi folks — maintainer here but haven't checked in in a while. anyone got suggestions for a resolution? |
As far as I can tell if you put a js alert in the body on a page, then click a link to another page, then press the back button the browsers that I tested all (except firefox) showed the alert again. This SO question seems to confirm the same thing (http://stackoverflow.com/questions/2638292/after-travelling-back-in-firefox-history-javascript-wont-run). |
Not sure I fully understand this issue. If you want code to be executed every time the DOM is updated by Turbolinks (e.g. to attach event listeners to new elements), you should bind to the The Let me know if this didn't answer your question. |
@rstacruz I'm not sure whether you would be better using |
@amnesia7 looks like I was wrong about |
Sorry, wrong link: turbolinks/turbolinks-classic#551 |
Thanks @Thibaut, sounds like its best to hold back on making a decision about how jquery.turbolinks should work with back button until turbolinks/turbolinks-classic#551 has been resolved. |
@sandrodz this fix by @Thibaut resolved all my back button issues: turbolinks/turbolinks-classic@25f07dd |
How I solved this problem: 1) Use the master version of turbolinks: gem 'turbolinks', :git => 'https://github.com/turbolinks/turbolinks-classic' Why? The latest version released was 2) Use $(window).on('page:restore', function(e) {
console.log('backspace')
}); |
this is a great plugin, it fixed most of my issues but 1.
When you use browser back button no events are fired.
The text was updated successfully, but these errors were encountered: