| | 132 | |
|---|
| | 133 | function clearAuthenticationCache(page) { |
|---|
| | 134 | // Default to a non-existing page (give error 500). |
|---|
| | 135 | // An empty page is better, here. |
|---|
| | 136 | if (!page) page = '.force_logout'; |
|---|
| | 137 | try{ |
|---|
| | 138 | var agt=navigator.userAgent.toLowerCase(); |
|---|
| | 139 | if (agt.indexOf("msie") != -1) { |
|---|
| | 140 | // IE clear HTTP Authentication |
|---|
| | 141 | document.execCommand("ClearAuthenticationCache"); |
|---|
| | 142 | } |
|---|
| | 143 | else { |
|---|
| | 144 | // Let's create an xmlhttp object |
|---|
| | 145 | var xmlhttp = createXMLObject(); |
|---|
| | 146 | // Let's prepare invalid credentials |
|---|
| | 147 | xmlhttp.open("GET", page, true, "logout", "logout"); |
|---|
| | 148 | // Let's send the request to the server |
|---|
| | 149 | xmlhttp.send(""); |
|---|
| | 150 | // Let's abort the request |
|---|
| | 151 | xmlhttp.abort(); |
|---|
| | 152 | } |
|---|
| | 153 | } catch(e) { |
|---|
| | 154 | // There was an error |
|---|
| | 155 | return; |
|---|
| | 156 | } |
|---|
| | 157 | } |
|---|
| | 158 | |
|---|
| | 159 | function createXMLObject() { |
|---|
| | 160 | try { |
|---|
| | 161 | if (window.XMLHttpRequest) { |
|---|
| | 162 | xmlhttp = new XMLHttpRequest(); |
|---|
| | 163 | } |
|---|
| | 164 | // code for IE |
|---|
| | 165 | else if (window.ActiveXObject) { |
|---|
| | 166 | xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); |
|---|
| | 167 | } |
|---|
| | 168 | } catch (e) { |
|---|
| | 169 | xmlhttp=false |
|---|
| | 170 | } |
|---|
| | 171 | return xmlhttp; |
|---|
| | 172 | } |