Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linkedin button dynamic rendering

How to render linkedin button in a dynamic way? e.g. writing the "<script type='in/share'></script>" at runtime or after the page has finished loading. I already tested on writing it or appending it in the body tag using jquery but it doesn't work. I'll appreciate any help. thanks.

like image 745
Epok Avatar asked Feb 02 '23 18:02

Epok


1 Answers

For anyone still wondering how to do this, after you load your

<script type="IN/Share"></script> //Don't forget other attributes

Just call IN.init() in your javascript and it will render the buttons.

The Developer guide does say something about using undocumented functions, but this forum post on the developer site:

https://developer.linkedin.com/forum/3-problems-share-button

As stated by Eugene O'Neill (Web Developer for LinkedIn)

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.

like image 160
Cubed Eye Avatar answered Feb 08 '23 14:02

Cubed Eye