Latest Post

LinkedIn JavaScript SDK – Detecting login window close event

This post covers the solution of a frustrating question – “How to detect login window close event while using LinkedIn Javascript SDK?”

As per the documentation, we are supposed to use the following code to authenticate a user using the api:

IN.User.authorize();

The above code was also responsible for opening the login popup.

Now, in order to detect the login window’s close event, the above code needs to be replaced with the following code:

var linkedin = IN.UI.Authorize().place();
linkedin.onWindowRemove.subscribe(function() {
// perform some action
});

The linkedin object gives us access to the LinkedIn’s authorization UI – which is usually the popup which opens when a user tries to sign in using LinkedIn.