3

I have custom logout page created. I have used an application page for logout. In the application page, I use a javascript and say document.execCommand(ClearAuthenticationCache).

This works fine in IE to logout, but when I try to logout in Mozilla or Chrome, I am unable to logout. Please provide me details on how to succesfully logout in a custom application page in Mozilla and Chrome. I am using ADFS authentication.

0

2 Answers 2

1

If the user logs out in IE, he will be having document.execCommand("ClearAuthenticationCache"); else if user logs out from Mozilla, he will be sent to ADFS logout page.

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

    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>
1
  • 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; }
    – Nikhil J
    Dec 19, 2012 at 8:39
0

http://social.msdn.microsoft.com/Forums/da-DK/sharepointdevelopment/thread/ff30c5dd-356f-48b9-a3b7-72d477d64d14 appears to have a solution.

I do not have a site up that i could test this on, but let me know if it is helpful!

1
  • thanks, but i have tried this . . this doesnt really work.
    – Nikhil J
    May 19, 2012 at 11:35

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.