Sign In As Another User SharePoint 2013 – The Same But Easier Approach

I was browsing a site the other day looking for an answer to something hoping someone had come across as well and what do you know? I came across something as well.

Very similar to my previous post, but now you don’t have to type in the address bar all the time. You can save the below link as a bookmark/favorite and the JavaScript will basically add your URL to a string and will ask you to sign in again. Easier when you’re in a hurry and also to avoid typos!

Save below as a bookmark:

javascript:(function(){var ctx=new SP.ClientContext.get_current();var web=ctx.get_web();ctx.load(web,'Url');ctx.executeQueryAsync(Function.createDelegate(this,success),Function.createDelegate(this,failed));function success(sender,args){var url=web.get_url();window.location=url+'/_layouts/closeConnection.aspx?loginasanotheruser=true';};function failed(sender,args){alert('Error\n'+args.get_stackTrace());};})();