Jun 30
Permalink

Sharing the pain…

After hours of wrestling with what should have been a trivial integration with facebook (facebook share button), have finally worked out what was going wrong for me. 

Facebook share ends up calling a url (what looks like a php page - sharer.php) which is provided with a u param for the url you are trying to share (there’s also a t param for the title, but see below).

Many people are probably using this to integrate as a widget into their wordpress or other blog, for which the rest of this is largely irrelevant, but If you are  trying to integrate facebook share into a localhost runinng app, then there are certain anomalies.

If facebook can’t access the url being shared, but the url ends in a typical extension (like .html) then the url appears as normal (as above). However if it looks like a path, it doesn’t include the url. 

I assume this is to do with not being able to guess the mimetype of the document. When facebook can access the url, then it connects to the server (to grab meta tags which override the t param for example), and can then include the document.

Simple fix, but hard won - unfortunately I went through a number of other possible problems (unicode issues, javascript conflict) before the lack of extension hit me as the obvious solution.

blog comments powered by Disqus