Skip to content

Instantly share code, notes, and snippets.

@mucahit
Last active May 7, 2018 16:19
Show Gist options
  • Save mucahit/cc0c2cc3399a06c36959b4b261fd7beb to your computer and use it in GitHub Desktop.
Save mucahit/cc0c2cc3399a06c36959b4b261fd7beb to your computer and use it in GitHub Desktop.
Share Link and Text on Facebook using Javascript.
let base_url = "https://www.facebook.com/sharer/sharer.php?"; // Base url
// Params
const params = {
u: "http://google.com",
quote: "Replace this with your text",
};
for(const prop in params) base_url += `&${prop}=${encodeURIComponent(params[prop])}`;
window.open(base_url, '', 'left=0,top=0,width=550,height=450,personalbar=0,toolbar=0,scrollbars=0,resizable=0');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment