Search code examples
javascriptruby-on-railstumblr

Tumblr's share-button script doesn't work


In a rails app I have a Tumblr share button:

<a href="<%= "https://www.tumblr.com/widgets/share/tool?canonicalUrl=#{tips_and_trick_url(tip)}" %>" data-title="<%= tip.title %>" data-content="<%= tip.content %>" target="_blank">

As it is said in documentation, I have to include <script id="tumblr-js" async src="https://assets.tumblr.com/share-button.js"></script> after </body> tag. Clicking on the share button it takes me to a new tab, but as I understand, a pop-up window should appear. So, the question is how to reach the desired result, to make a pop-up window appear? Thanks.


Solution

  • On pages that include the JavaScript code of our "Share" button (listed below), this button is a binding tag with the tumblr-share-button: class tumblr-share-button:

    It seems you are missing the class attribute:

    <a class="tumblr-share-button" href="<%= "https://www.tumblr.com/widgets/share/tool?canonicalUrl=#{tips_and_trick_url(tip)}" %>" data-title="<%= tip.title %>" data-content="<%= tip.content %>"></a>
    

    Source: https://translate.googleusercontent.com/translate_c?depth=1&hl=en&ie=UTF8&prev=_t&rurl=translate.google.co.uk&sl=auto&sp=nmt4&tl=en&u=https://www.tumblr.com/docs/ru/share_button&usg=ALkJrhg99ccfkG9zPv8gj6gxiMFxalMUGA