Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

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>
share|improve this answer
    
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 Dec 19 '12 at 8:39
add comment

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!

share|improve this answer
    
thanks, but i have tried this . . this doesnt really work. –  Nikhil May 19 '12 at 11:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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