Mobile sites are very restricted in the use of Javascript since most of the mobile phones does not support Javascript at all and that was the main restriction on adding a Facebook Share or Twitter Status update to share a article or url on a mobile site.
After a lot of though and research I have found out a way to add social media features on a mobile site. The concept is simple: use the API’s url to share inside a link, but there is a drawback: is one way only deal, or by that I mean, once the user clicks on the link he will be redirected to Facebook or Twitter site and to return to yours, he will need to manually go back.
Sharing on Facebook: http://m.facebook.com/sharer.php?u=<urlencoded url>t=<urlencoded title>
Updating status on Twitter: http://mobile.twitter.com/home?status=<urlencoded status>
As a final note, remember that Twitter has a restriction of 140 characters, so when sharing your url you must make sure that it complies with it.
Have fun and socialize your mobile site.
May 6th, 2010 at 11:17 AM
[…] Adding Facebook Share and Twitter Status updates on your mobile site « PHP Libraries, API'… […]
May 6th, 2010 at 12:30 PM
[…] This post was mentioned on Twitter by mcloide. mcloide said: Adding Facebook Share and Twitter Status updates on your mobile site: Mobile sites are very restricted in the use … http://bit.ly/cOCe08 […]
May 6th, 2010 at 2:40 PM
Have fun
January 2nd, 2011 at 11:30 AM
Dude, lots of research for this??
January 3rd, 2011 at 10:03 AM
Well, this is the easier way to setup. If you want something more complex you can build your own share and like buttons with the API, but you got to remember, only 10% of cell phones are really smartphones if you look on World Wide context, if you look on US, about 80% are smartphones, so, if your target is only phones from US, then you can use the javascripts API’s with no problem.
July 13th, 2011 at 3:24 AM
How can we send comment through this url
July 15th, 2011 at 11:17 AM
This is only the status api, for sending comments you have to use other methods from the api. For more api info go to: http://developers.facebook.com/
September 29th, 2011 at 4:20 AM
Hi mcloide
I want to set like button in mobile Site. If you know, teach me how to set it, please.
September 29th, 2011 at 9:21 AM
There is a way, but it will require some work. What you will need to do is to translate the like button from a FB XML format to HTML format with some JS to allow the like to work. If you can click a normal link and set a like on Facebook you can do that.
As example, checkout this share button that is on all posts of the blog:
When the click on this button happens, then the page is redirected to the facebook share url that you can get on the facebook developers guide.
November 3rd, 2011 at 3:46 AM
facebook scraps…
[…]Adding Facebook Share and Twitter Status updates on your mobile site « PHP Libraries, API's and Frameworks[…]…
December 7th, 2011 at 5:31 PM
Your link is incorrect up top:
Sharing on Facebook: http://m.facebook.com/sharer.php?u=t=
Should be:
Sharing on Facebook: http://m.facebook.com/sharer.php?u=&t=
Missing the Ampersand
(Note: Facebook really doesn’t read this title, it grabs the title from title tag of the webpage of the link you pass to it)
So in reality, if you were going to share IBM.com
Sharing on Facebook: http://m.facebook.com/sharer.php?u=ibm.com
January 5th, 2012 at 11:07 PM
Not working.
January 6th, 2012 at 10:29 AM
This post is quite old so check if the current api haven’t been changed or updated. I believe that Facebook already have a better method add the like and share buttons via mobile.
June 8th, 2012 at 1:44 AM
Why s that i can not upload my photos? Pls help
June 9th, 2012 at 6:16 PM
Got check, you might need a different api for that.
September 17th, 2012 at 10:34 PM
why is that i can not install my facebook android application to my phone?
September 19th, 2012 at 11:07 AM
That is not really an mobile site from facebook so I would suggest you to look for any Android Forums, they will be able to help you better.
October 19th, 2012 at 5:48 AM
The parameter t is get rided off no way to add text in the textfield directly just sharing the url can you help us?
October 19th, 2012 at 11:58 AM
This code is a bit outdated, so need to check if the parameter has been updated with the newer versions of the API.
Anyway, this was done to support old style mobile devices. Now most of the devices are smartphones so you can use newer technologies such as ShareThis.
February 25th, 2013 at 5:23 AM
while traying share to facebook and use :
http://m.facebook.com/sharer.php?t=welcome &u=www.dual-it.com
facebook read the link and can’t red the text !? WHY 😦
February 25th, 2013 at 6:15 PM
make sure that it is url encoded but the param seems correct. As a text you can also copy the url that you get when using the sharethis buttons.
April 4th, 2013 at 9:03 AM
[…] mcloide.wordpress.com/2010/05/… […]
April 4th, 2013 at 10:02 AM
[…] https://mcloide.wordpress.com/2010/05/06/adding-facebook-share-and-twitter-status-updates-on-your-mob… […]