]> cgit.babelmonkeys.de Git - adhocweb.git/blobdiff - js/main.js
Fix disconnection on leaving the page
[adhocweb.git] / js / main.js
index c03a8cf74c391428363da43a2f1269f1fb40d9c3..188dfc762eda4af93e1ac45659c9671bf8046d5f 100644 (file)
@@ -143,7 +143,7 @@ function addForm(elem, x) {
 }
 
 function serializeToDataform(form, st) {
-    st.c("x", {"xmlns":"jabber:x:data", "type": "submit"});
+    st.c("x", {"xmlns": "jabber:x:data", "type": "submit"});
     $(form).find(".df-item").each(function(){
         st.c("field", {"var": $(this).attr("name")});
         if (this.nodeName.toLowerCase() == "select" && this.multiple) {
@@ -339,9 +339,8 @@ $(document).ready(function () {
     });
 });
 
-onunload = function() {
+window.onunload = window.onbeforeunload = function() {
     if (connection) {
         connection.disconnect();
     }
 }
-