This repository has been archived by the owner on Sep 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 621
Is there a similar event to onbeforeunload? #146
Comments
Listen for You can combine this with var dispatchUnloadEvent = function() {
var event = document.createEvent("Events")
event.initEvent("turbolinks:unload", true, false)
document.dispatchEvent(event)
}
addEventListener("beforeunload", dispatchUnloadEvent)
addEventListener("turbolinks:before-render", dispatchUnloadEvent) |
And which one is suppose to fix this issue? |
That was 5 years ago... but I think @sstephenson fix worked for me. Basically create a meta event that is triggered both by the browser and turbolinks. Make sense? By the way, thanks @sstephenson I am just a few years late in saying that! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Is there a similar event to onbeforeunload?
Looking for a way to attach onto an event when transitioning off of a page with or without a turbolinks link. Is that possible?
Thanks!
The text was updated successfully, but these errors were encountered: