social-share-button
social-share-button copied to clipboard
Uncaught ReferenceError: SocialShareButton is not defined at HTMLAnchorElement.onclick
Hello,
I have installed the gem ok and get the social share buttons to show, but when I click (in dev environment) nothing happens…
I get the following error in the console -
Uncaught ReferenceError: SocialShareButton is not defined at HTMLAnchorElement.onclick (VM7889 62:777) onclick @ VM7889 62:777
Any help appreciated!
Add this to your application.js
//= require social-share-button
what if i am using webpack
i am using webpack too. what should i do?
Having same problem. Anyone know?
Also using Webpack on Rails 6. any solutions yet?
Thanks @hopewise but should have specified I am also using Webpack :)
@gareth326771 Any solution for this issue if we are using webpack?
I have the same issue, using webpack as well.
I too have the same issue using webpacker
Same :(
@DyllanCullingworth you saved my life!!!
Any official solution to use it with rails 6? @DyllanCullingworth website is down.
Still no solution @maariavld, could you explain what you did to make it work?
@gabrielgomeso I ended up not using it in the end and I forgot how I made it work, but it was with an article written by @DyllanCullingworth. I ended up using this, as my use case was quite simple, to share online a "premade" post:
<a href="https://twitter.com/intent/tweet?url=<your_link>&text=<your_text>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=240,width=600');return false;" class= "your_css_class">
<a href="https://www.facebook.com/sharer/sharer.php?u=<your_link>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=240,width=600');return false;" class="<your_css_class>">
A workaround is to copy then content of this file in a javascript/vendor/social-share-button.js
file and then import this file in javascript/application.js
.