stable-diffusion-webui
stable-diffusion-webui copied to clipboard
Warn the user when navigating away from the Web UI
Is your feature request related to a problem? Please describe. The webui allows navigating away from it without warning the user.
Describe the solution you'd like
I would like a warning from the browser when navigating away from the WebUI.
This can be done in javascript by adding something like this.
window.addEventListener('beforeunload', (event) => {
event.returnValue = Are you sure you want to leave?
;
});
Taken from page linked in Additional Context.
work around Use last saved image if there and import it and copy the parameters with the BUTTON to the desired tab. (I was doing it by hand like some schmuck.. never saw the button :) Also spent 10m looking for SD model in settings when it was put on main page.. lol. I thought i was losing my mind, anyway.)
Additional context Blog post on this unload-'script' : https://dev.to/chromiumdev/sure-you-want-to-leavebrowser-beforeunload-event-4eg5
-edit: added workaround
UPDATE: Recent changes in GUI seem to take away focus from the controls when it is done generating. This means that if you are typing in your Prompt edit box and the generation finishes it loses focus. When you then type BACKSPACE or ctrl/shift arrow keys navigations of the browser will occur. That's why i suddenly have so much need for this feature.
Alternative: save the current settings as browser cookies or something so reopening the site fills the last options.
indeed... when using it on a phone browser, it is usual to have to scroll up and down and many times i end up doing the gesture to reload the page and lose all settings.
+1 yeah I've accidentally refreshed on mobile so many times just trying to scroll the page and lost my work.
Alternative: save the current settings as browser cookies or something so reopening the site fills the last options.
I second this. Sometimes the tab crashes, or other bugs require refreshing the tab and all settings are lost. Some method of saving settings, whether stored in cookies or a text file (I'd prefer this but it might be an issue for shared online installations) would be really nice.
Cookies might clash for different browser tabs though. But i don't see one needing to exclude the other. Perhaps create a dedicated feature request for the cookies. But like i said.. that might get real funky with multiple tabs open.
I suppose that could be added to https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/script.js and a pull request with it could be created?
Would love this feature! at the very least for mobile.
made an extension https://github.com/w-e-w/sdwebui-close-confirmation-dialogue