Linkedin Share Button in Rails 4 with Turbolinks Enabled
- Categories:
- javascript
- rails
Update 2020-05-07: This script based on old version Rails, Turbolinks, and Official Linkedin’s Javascript share button.
While implementing Linkedin share-button on my Rails 4 application with Turbolinks enabled, I encounter problem how to reload Linkedin share-button correctly because my code always showing “duplicate in.js loaded, any parameters will be ignored”.
After a little googling, I found that I just need to flush old Linkedin instance by delete IN
. Here is my solution to implement Linkedin share-button with Turbolinks in Rails 4.0.0.
Official Implementation
Solution
First, Remove the following script from body
tag.
And then load the following script inside the head
tag.
- Tags:
- #turbolinks
- #rails
- #javascript
Sponsored Links
- Register to Digital Ocean cloud with this link and get $200 credit
- Looking for cheap CDN? Bunny is the answer
- Alternative Cloud besides AWS and Digital Ocean