Reputation: 7941
I'm using a button that will let visitors tweet the blog post. I'm using the following code:
<li class="ft-stwitter">
<a rel="nofollow" target="_blank" href="https://twitter.com/intent/tweet?url=http://www.mywebebsite.com/the-url/&text=Blog Title" onclick="javascript:window.open(this.href,
'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
<i class="icon-twitter"></i> Share on Twitter
</a>
</li>
It works fine. On the same page, I've the official Twitter follow button too. The code is as follows:
<a href="https://twitter.com/cracked" class="twitter-follow-button" data-show-count="false" data-show-screen-name='false' data-lang="en">Follow @Storypicker</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
Now when I click on "Share on Twitter" link, two popups open. How can I fix it? What am I doing wrong? Please guide me. :(
Here's the problem fiddle: http://jsfiddle.net/zk79C/2/
UPDATE:
The issue was a bug but it is marked as fixed. https://dev.twitter.com/issues/191
Upvotes: 0
Views: 800
Reputation: 731
In the href, replace
https://twitter.com/intent/tweet?
by
this solved the issue for me. It seems that the first url is calling a script which opens the second popup. But, oddly, this happens only in Firefox (current v51.0.1).
Upvotes: 1
Reputation: 7941
Ok, I solved it myself. Here's the solution:
<li class="ft-stwitter">
<a rel="nofollow" target="_blank" href="https://twitter.com/intent/tweet?url=http://www.mywebebsite.com/the-url/&text=Blog Title">
<i class="icon-twitter"></i> Share on Twitter
</a>
</li>
The onclick is not required.
Upvotes: 4
Reputation: 391
Your link opens a new window and then the javascript does too.
Show the HTML that appears in the browser and not your server code
Upvotes: 0