Thread overview
How to reset the website when the user leaves it, with vibe.d?
Jun 29, 2021
vnr
Jun 29, 2021
WebFreak001
Jun 29, 2021
WebFreak001
Jun 29, 2021
vnr
Jun 29, 2021
vnr
June 29, 2021

Hello 😊

I have a bit of a problem that seems simple enough, but I can't find an answer to my questions. On my website, I have two textareas that the user can write on. When the user reloads the page or closes it and then reopens it, the text he wrote is still written, which is quite annoying.

So my question is how to reset the website (the page) when the user reloads or quits.

I've looked at the vibe.d's sessions, because that's probably where the answer to my question lies, but from what I understand, it requires a "login and logout form" (at least, all the code examples do this), which I don't want, because I want the website to be accessible without logging in.

Do you have any ideas on how to fix this, probably with sessions?

June 29, 2021

On Tuesday, 29 June 2021 at 16:25:09 UTC, vnr wrote:

>

Hello 😊

I have a bit of a problem that seems simple enough, but I can't find an answer to my questions. On my website, I have two textareas that the user can write on. When the user reloads the page or closes it and then reopens it, the text he wrote is still written, which is quite annoying.

So my question is how to reset the website (the page) when the user reloads or quits.

I've looked at the vibe.d's sessions, because that's probably where the answer to my question lies, but from what I understand, it requires a "login and logout form" (at least, all the code examples do this), which I don't want, because I want the website to be accessible without logging in.

Do you have any ideas on how to fix this, probably with sessions?

this is a client behavior that is implemented by some browsers, it has nothing to do with vibe.d.

Set autocomplete to off to fix this: https://stackoverflow.com/questions/2486474/preventing-firefox-from-remembering-the-input-value-on-refresh-with-a-meta-tag

June 29, 2021

On Tuesday, 29 June 2021 at 19:05:43 UTC, WebFreak001 wrote:

>

[...]

I should add that this is a convenience feature for users and you should avoid setting this unless it absolutely doesn't make sense that stuff is prefilled for the user.

It's there to keep input in case you accidentally refresh the page.

June 29, 2021

On Tuesday, 29 June 2021 at 19:05:43 UTC, WebFreak001 wrote:

>

On Tuesday, 29 June 2021 at 16:25:09 UTC, vnr wrote:

>

Hello 😊

I have a bit of a problem that seems simple enough, but I can't find an answer to my questions. On my website, I have two textareas that the user can write on. When the user reloads the page or closes it and then reopens it, the text he wrote is still written, which is quite annoying.

So my question is how to reset the website (the page) when the user reloads or quits.

I've looked at the vibe.d's sessions, because that's probably where the answer to my question lies, but from what I understand, it requires a "login and logout form" (at least, all the code examples do this), which I don't want, because I want the website to be accessible without logging in.

Do you have any ideas on how to fix this, probably with sessions?

this is a client behavior that is implemented by some browsers, it has nothing to do with vibe.d.

Set autocomplete to off to fix this: https://stackoverflow.com/questions/2486474/preventing-firefox-from-remembering-the-input-value-on-refresh-with-a-meta-tag

Thanks a lot for the explanations, I didn't know the autocomplete="off" tag.

Nevertheless, the problem persists and seems to be even deeper, indeed, my site is hosted on Heroku and I can see what a user who is on another machine has written (behavior I just found out). Fortunately, this little site is only for entertainment purposes, but it is a behavior that seems quite vicious.

If you want to access the code, it is on this repository (it is just a playground for the language of a friend).

June 29, 2021

On 6/29/21 4:25 PM, vnr wrote:

>

Nevertheless, the problem persists and seems to be even deeper, indeed, my site is hosted on Heroku and I can see what a user who is on another machine has written (behavior I just found out). Fortunately, this little site is only for entertainment purposes, but it is a behavior that seems quite vicious.

If you want to access the code, it is on this repository (it is just a playground for the language of a friend).

Has nothing to do with sessions, you are saving the text posted, and then making it the default text whenever the page is rendered.

here is where you save the text. here you pass it to the template, and here you render it as the child of the text area.

Just don't do that ;)

-Steve

June 29, 2021

On Tuesday, 29 June 2021 at 20:40:29 UTC, Steven Schveighoffer wrote:

>

On 6/29/21 4:25 PM, vnr wrote:

>

[...]

Has nothing to do with sessions, you are saving the text posted, and then making it the default text whenever the page is rendered.

here is where you save the text. here you pass it to the template, and here you render it as the child of the text area.

Just don't do that ;)

-Steve

Ah, yes! Thanks a lot for pointing out the concerns, it was pretty simple. I understand better, thank you both :)