]> git.nbdom.net Git - nb.git/commitdiff
nb.js basicauth_logout
authorDevops <sys@15gifts.com>
Sun, 23 Apr 2017 00:08:05 +0000 (01:08 +0100)
committerDevops <sys@15gifts.com>
Sun, 23 Apr 2017 00:08:05 +0000 (01:08 +0100)
lib/js/nb.js

index 7c413c5f0de74bd2ad456e53a2188b889959c887..3d9476df848865918c5b16af8b8f9ea429e38ef1 100644 (file)
@@ -59,6 +59,30 @@ function NB(args) {
       return [parseInt(width),parseInt(height)];
   }
 
+  this.basicauth_logout = function() {
+      var userAgent = navigator.userAgent.toLowerCase();
+
+      if (userAgent.indexOf("msie") != -1) {
+          document.execCommand("ClearAuthenticationCache", false);
+      }
+
+      xhr_objectCarte = null;
+
+      if(window.XMLHttpRequest)
+          xhr_object = new XMLHttpRequest();
+      else if(window.ActiveXObject)
+          xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
+      else
+          alert ("Your browser doesn't support XMLHTTPREQUEST");
+
+      xhr_object.open ('GET', '/logout', false, '\0', 'password');
+      xhr_object.send ("");
+      xhr_object = null;
+
+      document.location = window.location;
+      return false;
+  }
+
   this.maximize = function(s) {
     var height = $(window).height();
     var width = $(window).width();