Skip to content

Instantly share code, notes, and snippets.

@McKinneyDigital
Created June 6, 2012 20:21
Show Gist options
  • Star 30 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save McKinneyDigital/2884508 to your computer and use it in GitHub Desktop.
Save McKinneyDigital/2884508 to your computer and use it in GitHub Desktop.
Share to Twitter from a link using Javascript
// Opens a pop-up with twitter sharing dialog
var url = "http://google.com";
var text = "Replace this with your text";
window.open('http://twitter.com/share?url='+encodeURIComponent(url)+'&text='+encodeURIComponent(text), '', 'left=0,top=0,width=550,height=450,personalbar=0,toolbar=0,scrollbars=0,resizable=0');
@marcusx2
Copy link

@tassiocaique How can we share image??

@yeecai
Copy link

yeecai commented Jan 12, 2022

How can we close the window after posting the link?

@zhengyimeng
Copy link

How can we share image?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment