/    Sign up×
Community /Pin to ProfileBookmark

Logout through XMLHTTPRequest Object is not working in Opera

I am using the basic authentication mechanism for my website in IIS. To logout the user I am using something similar to this JavaScript function:

[CODE]
function logoutUser() {
setTimeout(‘location.reload(true)’, 1000);
xmlhttp = GetXmlHttpObject();
if (xmlhttp==null) {
return;
}
//alert(xmlhttp);
var url = “index.php”;

xmlhttp.open(“GET”, url, true, “dummy_user”, “dummy_password”);

xmlhttp.setRequestHeader( “If-Modified-Since”, “Sat, 1 Jan 2000 00:00:00 GMT” );
xmlhttp.setRequestHeader( ‘Accept’, ‘message/x-formresult’ );
xmlhttp.send(null);
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
// code for IE6, IE5
return new ActiveXObject(“Microsoft.XMLHTTP”);
}
return null;
}

[/CODE]

The idea is to force a request with some invalid credentials, in order to invalidate the real credentials cached by the browser.

It is working fine in IE,Firefox, Safari, Google Chrome but not in Opera.

Please help me in this regard.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @sobiaa spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...