I have configured fba in my site using thinktecture. When I click sign out or sign in as different user, sharepoint redirects me to following page:


If I select windows authentication in dropdown, it redirect me to user homepage without prompting authentication dialogue.

For IE I got the solution like this:


but it's not working in chrome and mozilla. I have searched many sites on google but nothing help much.

I have tried following patch too.But nothing work for chrome and firefox.

Open Internet Explorer -> Tools - Internet options - > Local intranet Zone - > user Authentication ; Select - prompt For user name and password.

Thanks in advance.

2 Answers 2


you can not log out from SharePoint just setting a logout URL to your browser. I dug it a lot after that I found there is a session cookie which name is "FedAuth" is responsible for user logout as soon as you delete that cookie it will log out your session. it is a serverside session cookie so you can't find it out in document.cookie. you need to call a REST API to delete this cookie in server side. this approach I was following in Sharepoint on-Premise. but Sharepoint online I think it is not possible. or may be possible if you are able to delete "FedAuth" cookie.

enter image description here


Try following code samples.Any one should work:


<script type="text/javascript">
function _spBodyOnLoad() {
    var PreviousPage = document.referrer.split('/')[3];      
    if (PreviousPage == "adfs") {
        var searchString = getQueryStringParameter('site');
    var browserName = navigator.appName.toLowerCase();
    if (browserName.indexOf("internet explorer") != -1) {
        location.replace("/ABCD/SitePages/Page.aspx?site=" + PreviousPage);
        else {
            var LogOutUrl = "https://ABCD/adfs/ls/?wa=wsignout1.0";

function getQueryStringParameter(paramName) { 
    var searchString = window.location.search.substring(1); 
    var i; 
    var val; 
    var params = searchString.split("&"); 
    for (i = 0; i < params.length; i++) { 
        val = params[i].split("="); 
        if (val[0] == paramName) { 
            return val[1]; 

    return null; 


<script language="javascript" type="text/javascript">
  var agt=navigator.userAgent.toLowerCase();
  if (agt.indexOf("msie") != -1) {
    // IE clear HTTP Authentication
  else {
    // Let's create an xmlhttp object
    var xmlhttp = createXMLObject();
    // Let's get the force page to logout for mozilla
    // Let's send the request to the server
    // Let's abort the request
  // Let's redirect the user to the main webpage
  window.location = "/rest/";
} catch(e) {
// There was an error
alert("there was an error");

function createXMLObject() {
    try {
        if (window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        // code for IE
        else if (window.ActiveXObject) {
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
    return xmlhttp;
  • can you tell me where should i place this code as i do not have custom sign out. we are using SharePoint given sign out . Apr 9, 2015 at 10:09
  • Try adding this is master page
    – 404
    Apr 9, 2015 at 10:15
  • I have implemented both the scripts. The first one does not give any result. When i put the second script, my site goes into an infinity loop. The page getting refresh. Apr 9, 2015 at 11:45
  • Did you try and debug the script? Because i am using the same script and is working fine.
    – 404
    Apr 10, 2015 at 4:26
  • It executes without error but go in to loop. I can't figure it out. Apr 13, 2015 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.