LinkedIn dynamic button rendering

It has become standard to offer sharing functionality via major platforms such as Facebook, Twitter and LinkedIn on websites. Most of the platform providers have multiple options for inserting their sharing features often including the use of an iFrame.
LinkedIn is slightly different however choosing only to offer a javascript based solution similar to the following:
<script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
Above the inclusion of the required javascript function, and below the addition of sharing functionality where required.
<script type="IN/Share"></script>
When asynchronous pagination gets involved however this lack of an iFrame causes an issue: the javascript is not called as the asynchronous load takes place. This issue stumped me for for a while until I found the simple solution to call:
IN.init();
Eugene O’Neill (Web Developer for LinkedIn) has stated:

1) IN.Parse() and IN.Init() are here to stay. While we do employ the policy that any undocumented methods may or may not be supported indefinitely, these two are uniquely crucial to the functionality of the framework. The amount of work it would require to remove IN.Parse()… I don’t even want to think about it. IN.Init() is our preferred method for loading the framework asynchronously and won’t be going anywhere. Feel free to use either method.

4 thoughts on “LinkedIn dynamic button rendering”

  1. Sometime prior to 2012 Eugene stated that those functions were here to stay, but after all this time maybe things have changed…

    I haven’t needed to use this method for sometime, so I’m not able to comment on its current validity. Hopefully I’ll find some time to investigate and perhaps update the post, or perhaps another reader might be able to comment.

  2. It works.
    Need to use with //platform.linkedin.com/in.js?async=true

    Would be great to know if there is an event other than ‘onLoad’

Leave a Comment

Your email address will not be published. Required fields are marked *