Welcome Guest! You need to login or register to make posts.



Go to last post Go to first unread
#1 Posted : Friday, January 15, 2016 12:13:55 AM(UTC)

Rank: Member

Groups: Member
Joined: 10/19/2015(UTC)
Posts: 21

Thanks: 11 times

I am implementing a jquery browser closing event for protecting unsaved canvas template design. I am using Iframe api for editor.saveProduct(). If the user makes some design changes and if he attempts to close the browser tab without saving, I need to show a message. How can I do that?

Edited by user Friday, January 15, 2016 3:13:20 AM(UTC)  | Reason: Not specified

Kate D.  
#2 Posted : Tuesday, January 19, 2016 2:20:25 AM(UTC)
Kate D.

Rank: Advanced Member

Joined: 10/20/2015(UTC)
Posts: 52

Was thanked: 14 time(s) in 13 post(s)

You need to use the onbeforeunload jQuery function:


window.onbeforeunload = confirmExit;
function confirmExit(evt){
 var message = "You design is not saved. You will lost the changes if you leave the page."
    if (evt) {evt.returnValue = message;}
 return message; 

Your user will see the following window:

If user clicks the "Leave" button, the page will be closed and a design doesn't save.
If user clicks the "Stay" button, you need to call the saveProduct() method;

Best regards,
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.