kytta / shareon

📯 Lightweight, stylish, and ethical share buttons for popular social networks
https://shareon.js.org/
MIT License
466 stars 25 forks source link

Dynamically change URL of Shareon components when prompted #103

Open dominiciun opened 10 months ago

dominiciun commented 10 months ago

In some cases there are cases in which the location.href is not meant to be the shareable url.

kytta commented 10 months ago

You can use the data-url attribute on either the button or the button container (the one with class shareon). See the documentation here

dominiciun commented 10 months ago

I have tried this. It seems to only change the url on onload. When the attribute is changed after element is loaded shareon will not catch on to it.

kytta commented 10 months ago

Oh, yes, you have to call Shareon.init() after every update. For some reason, it's not in the documentation... I'll have to adjust that