Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Add "leave page" confirmation when leaving the devlog post page

A topic by Yngvarr created Jan 30, 2024 Views: 568 Replies: 6
Viewing posts 1 to 4

I spend too much time in the terminal and have developed the annoying habit of pressing Ctrl-W to remove the last word I typed in. So, naturally, I did it while typing in my devlog and all the content was lost.

I did some digging around and, in general, this feature is as simple as:

addEventListener("beforeunload", () => {
  if (/* there is some text in the text area */) {
    event.preventDefault();
  }
});

It displays a neat browser-defined window that asks if you meant to leave the page.

Would be nice to have it for every page where the content can potentially be lost while closing the page. Of course, it would help anyone who can potentially close the window without meaning to, not just nerds with weird habits. :)

(+1)

Tricky. Pages that do have that mechanism are usually annoying af. Because they will ask you for confirmation everytime you leave the page. Not just ctrl-w. Some pages do save the content of your edit box - or maybe the browser does. So if you re-open it quickly, some changes might still be there.

You can install a browser extension for blocking ctrl-w. If you have this habbit, it does not only affect writing on itch.

You could also have a ahk script remapping ctrl-w while the browser is active.

#IfWinActive ahk_exe chrome.exe
^w::
Send {Control Down}{Backspace}{Control Up}
return
#IfWinActive

I believe, the annoyingness depends on the implementation. I dislike it when gmail asks for confirmation out of the blue, when I don’t even type anything, but I’m also grateful for the pages that do it right.

As for autosaving, this would be even better. As far as I know, firefox does it by itself for simple inputs, but it’s not the case for itch. If itch could save your work in progress as drafts, the problem would be solved.

And, of course, I can fix it on my side, no big deal. I just figured that this may also be the problem for anyone who may close the tab unwillingly e. g. as the result of a power cut or a browser crash or by hitting the wrong key combination.

(1 edit)

 I also understand that this is a particular problem of yours and not a general problem of the community that uses Itch.

I also understand that you can solve it without any problem on your own, so I don't see the need to implement something like that, which, as you were told, could be uncomfortable for many users.

If a large user base had the same problem, I think a change like that is justified, but if not, I don't see the point either.

In the years that I have been using itch, I have never had that problem.

In any case, the decision to implement it or not is up to the administration and for what they can see and process accordingly, I think this post would go better in the suggestions subforum instead of the questions subforum.

Oh, wrong subforum, thanks for pointing out! Sorry for disturbing.

(1 edit)

Oh, it is a general nuisance for many webpages that have forms. But at the same time, accidental tab closing does not happen that often, and many sites (or the browsers) do save drafts. (Which is why I see the bigger nuisance in sites that pester you when you try do close the tab ;-)

I even remember seeing this happen on itch, but I do not know if that was something the browser did, or if the draft was temporarily saved on itch. I am logged in after all, so that would be possible.

Moderator moved this topic to Ideas & Feedback
Moderator(+2)

(moved to the right category)