How create a Facebook share button without SDK or custom app id?

Solution 1:

you can use facebook sharer link and a simple popup to do the job

$("#facebookShareLink").on("click",function(){
    var fbpopup = window.open("https://www.facebook.com/sharer/sharer.php?u=http://stackoverflow.com", "pop", "width=600, height=400, scrollbars=no");
    return false;
});

Solution 2:

It is possible. No need for an FB application for a simple sharing of URL. Create a simple pop up window and use Facebook share dialog.

https://developers.facebook.com/docs/sharing/reference/share-dialog This is still included in their API as of the moment.

window.open("https://www.facebook.com/sharer/sharer.php?u=http://www.gmanetwork.com/news/", "pop", "width=600, height=400, scrollbars=no");

Solution 3:

Create function who will center the pop-up every time.

function openURLInPopup(url, width, height, name) {
    if (typeof(width) == "undefined") {
        width = 800;
        height = 600;
    }
    if (typeof(height) == "undefined") {
        height = 600;
    }
    popup(url, name || 'window' + Math.floor(Math.random() * 10000 + 1), width, height, 'menubar=0,location=0,toolbar=0,status=0,scrollbars=1');
}

Then your link should look like this For Twitter:

 <a class="btn_twitter" onclick="openURLInPopup('http://twitter.com/home?status=http://www.domain.ro/url.html',600, 400); return false;" href="#" target="_blank">Twitter</a>

For facebook:

<a class="btn_fb" onclick="openURLInPopup('http://www.facebook.com/sharer.php?u=http://www.domain.ro/url.html',600, 400); return false;" href="#" target="_blank">Facebook</a>

For Google

<a class="btn_gplus" onclick="openURLInPopup('https://plus.google.com/share?url=http://www.domain.ro/url.html',600, 400); return false;" href="#">gplus</a>

Solution 4:

If you want to add your own (possibly dynamic) text, you can add the quote parameter to the link:

https://www.facebook.com/share.php?u=example.com&quote=YOUR+TEXT+HERE