How to prevent client disconected on unload event with nowjs?

196 views Asked by At

I develop an application with node.js, nowjs and expressjs server side and javascript / jquery client side.

I have a trigger client side when the client leave the page without saving the document before.

$(window).bind("beforeunload",function(e) {
    if (isFileModified) {
        return "File not saved.";
    }
});

My problem is that when this event is called, nowjs automatically disconnect the client before my event. Therefore if the client decides to stay on the current page,the now object is unloaded and its methods are unknown.

I found that it's possible to set the socket.io option 'sync disconnect on unload' to false but i don't know how to set this option client side with nowjs. And apparently this option doesn't work in firefox...

I there a good solution to prevent the client disconnnected in my case ?

Thanks a lot.

0

There are 0 answers