MansidakS Posted May 19, 2020 Share Posted May 19, 2020 Site URL: https://www.frostwriter.com Hi! I have a website where there is a <textarea> tag is being used. It basically allows the user to type in something and download the content as a txt file. I wish to add a feature that shows a dialog box in the browser which asks "Are you sure you wish to close the browser without saving your work"? I want to add this so that the user doesn't lose their content and can be reminded to download it before leaving the page or refreshing the page. I saw some similar questions in stack exchange but neither of them worked on Squarespace. Any kind of help would be really appreciated! Thanks in advance! Link to comment
paul2009 Posted May 19, 2020 Share Posted May 19, 2020 Looks like you have solved this. About: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. Content: Links in my posts may refer to SF Digital products or may be affiliate links. If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too. Link to comment
MansidakS Posted May 21, 2020 Author Share Posted May 21, 2020 On 5/19/2020 at 8:48 AM, paul2009 said: Looks like you have solved this. I did! Thanks for checking out the website though! It was just a js function that did the job. Link to comment
cmpnd Posted November 11, 2020 Share Posted November 11, 2020 Could you pretty please post the js function? I'm working on accessibility updates and I've come across a point that I don't think I can figure out without this js function. "Users must be warned of any timeout that could result in data loss, unless the data is preserved for longer than 20 hours of user inactivity. " If you can share your solution, that would be greatly appreciated. Also, I rather like frostwriter, so great job with that. Designer and lover of all things. Link to comment
tuanphan Posted November 12, 2020 Share Posted November 12, 2020 19 hours ago, cmpnd said: Could you pretty please post the js function? I'm working on accessibility updates and I've come across a point that I don't think I can figure out without this js function. "Users must be warned of any timeout that could result in data loss, unless the data is preserved for longer than 20 hours of user inactivity. " If you can share your solution, that would be greatly appreciated. Also, I rather like frostwriter, so great job with that. Have you found the code yet? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
cmpnd Posted November 13, 2020 Share Posted November 13, 2020 23 hours ago, tuanphan said: Have you found the code yet? I've been searching like crazy and so far none of my queries are bringing anything up thats useful. If/When I do find the code, I'll post here. Designer and lover of all things. Link to comment
paul2009 Posted November 13, 2020 Share Posted November 13, 2020 On 11/11/2020 at 7:35 PM, cmpnd said: Could you pretty please post the js function? You can do this with the onbeforeunload event. It allows you to display a "Leave site?" confirmation dialog box when the user tries to leave the current page. The message is determined by the browser. You add use this event by adding the following code to the code injection area, or by adding it to a Code Block on a specific page. <script> window.onbeforeunload = function(event) { event.returnValue = "Changes that you made may not be saved."; }; </script> If a post helps you, please click a "Like" option below ↘️ About: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. Content: Links in my posts may refer to SF Digital products or may be affiliate links. If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.