From: Devops Date: Sun, 23 Apr 2017 00:08:05 +0000 (+0100) Subject: nb.js basicauth_logout X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=14554bc396b12c6eacaa055335e065e0eade0e52;p=nb.git nb.js basicauth_logout --- diff --git a/lib/js/nb.js b/lib/js/nb.js index 7c413c5f..3d9476df 100644 --- a/lib/js/nb.js +++ b/lib/js/nb.js @@ -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();