Facebook and twitter share for mobile web

resting picture resting · Aug 25, 2011 · Viewed 43k times · Source

Is there a special url for sharing to Facebook and Twitter for mobile? Or are they the same as those from websites?

Using

<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>   
<a href="javascript:return false;" rel="nofollow" onclick="window.open('https://twitter.com/share?text=sometext&url=someurl', 'Twitter', 'toolbar=0,status=0,width=626,height=436')">Twitter</a>

for Twitter and

<script>
    function fbs_click() 
    {
        u='www.something';
        t='title';
        window.open('http://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
        return false;
    }
</script>

<a rel="nofollow" href="http://www.facebook.com/sharer/sharer.php?u=someurl" onclick="return fbs_click()" target="_blank" class="">Facebook</a>

for Facebook.

Answer

Simpleton picture Simpleton · Aug 25, 2011

Your sharing implementation should be the same and should work so long as your mobile users have devices capable or rendering JavaScript. Otherwise you can use each platforms' API url to share inside a link, the only problem is the callback redirects them either to Twitter or Facebook and they'll have to manually return to your site. The links are as below:

Sharing on Facebook:

http://m.facebook.com/sharer.php?u=<urlencoded url>t=<urlencoded title>

For example:

http://m.facebook.com/sharer.php?u=http://www.google.com

Updating status on Twitter:

http://mobile.twitter.com/home?status=<urlencoded status>