Reputation: 169
I am using twitter share button, which opens as a popup twitter window, but it fails to open when pop-up is blocked.
Is there any java-script which forces to use twitter even if popup is blocked?
Any help will be appreciated !!
Thanks in Advance
Upvotes: 0
Views: 731
Reputation: 5461
Usually, popups are blocked when they get opened asynchronously and NOT by a user action (such as button click).
To walk around the popup blocker, i suggest using the following:
html:
<input type="button" id="btn_tw" value="Share on Twitter" />
js:
document.getElementById('btn_tw').addEventListener('click', function(){
window.open('http://twitter.com/share?url='+ URL +'&text='+ TEXT, 'sharer', 'toolbar=0,status=0,width=626,height=436');
});
(URL
is the url you want to share, TEXT
is the post caption)
in this way, you use the feature manually, even without the twitter javascript sdk included.
hope that helps, and bypasses the popup blocker.
Upvotes: 1