Share on facebook - chrome extension

Posted by Anuraj on Wednesday, June 25, 2014 Reading time :1 minute

CodeProject HTML5 Javascript

Long back I wrote a post about how to create a chrome extension. This post is about creating an extension which will help you to share current page URL on facebook. You can follow the same steps in the previous post except few changes in the background.js file. And facebook uses a URL like this to accept URL -[URL to share].

    "title": "Share this URL on Facebook",
    "contexts": ["page", "link"],
    "onclick": function() {
		chrome.tabs.query({'active': true, 'lastFocusedWindow': true}, function (tabs) {

function Popup(url) {{'url': '' + url, 'type': 'popup'}, function(window) {});

And here is the screenshot of the extension running on my chrome browser.

Share on facebook from chrome extension

You can find the source code on GitHub -

Happy Programming :)

What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.

Did you like this article? Share it with your friends

Facebook Twitter Google+ LinkedIn Reddit StumbleUpon

BMC logoBuy me a coffee

Copyright © 2019 - Anuraj P. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Hosted with ❤ by GitHub