Completely Sign out in SharePoint 2013

How to Completely Sign out in SharePoint 2013

Step1: Create a page and add Script Editor Web Part to it.




Step2: Paste the below code to this web part.

Code: 
<script type="text/javascript">
function SignOut() {
debugger;
alert("Hi")
if (typeof SP !== 'undefined') {
    var ctx = new SP.ClientContext.get_current();
    var site = ctx.get_site();
    ctx.load(site, 'Url');
    ctx.executeQueryAsync(Function.createDelegate(this, function (sender, args) {
        var url = site.get_url();
        window.location = url + '/_layouts/closeConnection.aspx?loginasanotheruser=true';
    }), Function.createDelegate(this, function (sender, args) {
        alert('Error: ' + args.get_message());
    }));
} else {
    alert('Error: This is not a SharePoint 2010 or 2013 website');
}
}
</script>

<input type="button" value="SignOut" onclick="SignOut()" />

Here i have write the code to completely sign out in SharePoint 2013 on button Click Event.

Comments

Popular posts from this blog

How to Customize exported excel's cell background color in Datatables

Populate dropdown using jquery ajax in SharePoint

Customizing SharePoint list and implementing Quick search using jQuery