Tweet button disappears on navigating through link rails 4 twitter -


i have added tweet button in app appears when land on page or refresh page doesn't display button when navigate through link. displays text written within tag. can see difference in 2 cases through inspect element.

<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://example.com" data-via="sometext" data-size="large">tweet</a> <script>!function (d, s, id) {   var js, fjs = d.getelementsbytagname(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';     if (!d.getelementbyid(id)) {     js = d.createelement(s);     js.id = id;     js.src = p + '://platform.twitter.com/widgets.js';     fjs.parentnode.insertbefore(js, fjs);   } }(document, 'script', 'twitter-wjs');</script> 

i have copied above code link https://dev.twitter.com/web/tweet-button

the difference in 2 cases:

case 1: when button appears:

<iframe id="twitter-widget-0" scrolling="no" frameborder="0" allowtransparency="true" src="http://platform.twitter.com/widgets/tweet_button.7d9dd43d4f18b1bb51cc9d8f0997995e.en.html#_=1427878870272&amp;count=horizontal&amp;dnt=false&amp;id=twitter-widget-0&amp;lang=en&amp;original_referer=http%3a%2f%2flocalhost%3a3000%2fusers%2fedit&amp;size=l&amp;text=draft%20picks&amp;url=http%3a%2f%2fexample.com&amp;via=sometext" class="twitter-share-button twitter-tweet-button twitter-share-button twitter-count-horizontal" title="twitter tweet button" data-twttr-rendered="true" style="width: 140px; height: 28px;"></iframe> <script>!function (d, s, id) {   var js, fjs = d.getelementsbytagname(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';     if (!d.getelementbyid(id)) {     js = d.createelement(s);     js.id = id;     js.src = p + '://platform.twitter.com/widgets.js';     fjs.parentnode.insertbefore(js, fjs);   } }(document, 'script', 'twitter-wjs');</script> 

case 2: when button disappears

<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://example.com" data-via="sometext" data-size="large">tweet</a> <script>!function (d, s, id) {   var js, fjs = d.getelementsbytagname(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';   if (!d.getelementbyid(id)) {     js = d.createelement(s);     js.id = id;     js.src = p + '://platform.twitter.com/widgets.js';     fjs.parentnode.insertbefore(js, fjs);   } }(document, 'script', 'twitter-wjs');</script> 

i thankful if figure out how iframe displayed or removed on here or proper solution this. many in advance!!

it turbolink issue. javascript not loaded. links on did want javascript work added line of code after link_to tag

data: {no_turbolink: true} 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -