With facebooks release of the universal ‘like’ button, several webmasters complained of an error on clicking the button. Probably, the way facebook read/parses the sites had changed since the sites complaining of this error also had a problem getting the thumbnails of their links and any meta data, to show up in their facebook posts. A user figured out why

http://forum.developers.facebook.com/viewtopic.php?pid=220462#p220462

you can see the complete thread at

http://www.vergegraphics.com/blog/joomla/77-facebook-like-button-module (Verge graphics joomla module for the ‘like’  button works really well)

NOTE: before you try the below please backup the originals…

Now to get rid of the spaces in a joomla template I had to

1) go to in my templates/templatename/html/mod_mainmenu/default.php.
Line 33&35…removed the space.

NOTE: Simply deleting the space did not work I had to put in ‘  (for the geek in you-the entity used to represent a non-breaking space). So the lines looked like

$lspan = & $liFirstChild->addChild(‘span’, array(‘class’ => ‘l’));
$lspan->setData(‘ );
$rspan = & $liFirstChild->addChild(‘span’, array(‘class’ => ‘r’));
$rspan->setData(‘  );

2) Also had to change the space in the span “l” and “r” in functions.php (line 73) in the template root folder. Again I had to put in ` .

so it changed from

$result .= ‘<span><span> </span><span> </span>’

to

$result .= ‘<span><span>&nbsp;</span><span>&nbsp;</span>’

Now these files may not be in the same location in your case, you may have to hack the joomla core files in the module/mod_mainmenu/default.php. Its advisable, however, to copy the folders over to your template folder to create a template override

Hope this works for you as it did for us.

Note: if you are using word press…maybe header.php is the file to look at for the spaces in the spans?

Please feel free to enter any additions to the comments section…to help others, until facebook implements a fix.

Addition: See How Neth fixed the problem below…another probable solution if the above does not work for you.

Next? SCALE your business!
Get the latest tips, tricks, and topics in digital marketing. FREE!
Unsubscribe easily anytime.
jacobv
Tags:

56 Comments

  1. I’ve tried your solution and literally eliminated every space between every span tag in my code. I even went over the source code output to verify there are no spaces but still am getting the “page could not be reached error”. This is really aggravating bug on behalf of Facebook.

    1. Hi Neth,
      I hear ya! I spent at least 50 hours on this unnecessary diversion.
      Are you using sef components? WP or Joomla? Was it ever working? In my case, it was working and then stopped around the 18th of April (approx the time FB announced the universal like button)
      Can you send me a link that displays the problem? There is something on the page that is causing facebook to choke.
      All the best

  2. I hope the code is visible in comments.
    I have managed to fix the “Page could not be reached” issue as other solutions did not work for me.
    Edit the code in default.php to reflect the following changes:
    1)
    function CurrentPageURL()
    {
    $pageURL = $_SERVER[‘HTTPS’] == ‘on’ ? ‘https://www.yourdomain.com’ : ‘http://www.yourdomain.com’;
    $pageURL .= $_SERVER[‘PHP_SELF’];
    return $pageURL;
    }

    2)replace
    ($params->get(‘autourl’) == ‘yes’ ? $url = CurrentPageURL() : $url = $params->get(‘url’));

    with
    ($params->get(‘autourl’) == ‘yes’ ? $url = JURI::current() : $url = $params->get(‘url’));

    worked like a charm on my site.

  3. As for your question – I am using Joomla with Sh404sef and my solution applies to the verge extension. Seems like the problem is caused by 2 major reasons:
    1. As you’ve stated- the space in spans.
    2. Facebook not liking certain URL structures.

  4. Thanks so much for the time and effort you have put into finding a solution to this problem. I did exactly what you did and it fixed it for me.

    Thanks again.

    Travis

    1. Hi Travis, Thanks for taking the time to confirm that it worked. All the best.-Jacob

    1. Hi Hayan,

      I looked at the page source of your site and see spaces in the span class “l” and “r” within the span class=”art-button-wrapper”

      You will have to get rid of those spaces too.

      If I’m not mistaken you are using an artisteer template…you will probably find the span statements in a file in your template folder.

      There maybe other spaces in the span on your page too…the above was the first one I came across.

  5. Thank you for your instruction…but How I disable: facebook I Like show on frontpage..:-( I want only in articles..sry for my english..thank you

    1. The most common way is to go into the module and disable it for specific menus… Go into the module and under ‘menu assignment’ select only the menus you want the module to appear in. Hope this helps.
      p,s: you should go to the vergegraphics.com page and check with Max, he is very proactive in trying to help with his plugin

    1. Hi..I have been a bit tied up but will try to see if I can figure it out over the weekend. What platform are you using for the sites?

        1. Hi I spent a little time but could not find the issue…am not very familiar with blogger. Someone wrote this about blogger “Possible solution for Blogger users:
          In Blogger: turn Site-feed settings back to default.
          Let me know if it helps.”

  6. Hey, I am running into the same problem. I changed the thing to ” ” but I couldn’t find the in my functions thing. Any help would be appreciated. It works on “other” templates not the one I like though. 🙁

      1. yes, it’s on joomla. I tried doing the “&nsbp” thing but it showed “&nsbp” on the top menu. I put a “.” and that fixed it for a little, but I’m running into trouble again. My latest article’s (beBlog) won’t work but everything else works.

  7. Check also that your HTML is XHTML compliant.

    I had a single stupid which broke it!
    Changing to fixed it

  8. the HTML my last email got stripped

    i had a single BR tag without a closing /
    adding the closing / to the BR tag fixed this problem. phew. simple

    jsut put the whole document into an XML editor and validate it

    1. wow. I have not heard of that before…thanks for the input though. Hope it helps others

  9. I also have some problem. Unfortunatly it works on some sites but not on everyone.
    The root adress always works but on some sites i get the error.

    What can i do?

      1. I just tried to change the line 25 on default.php
        ($params->get(‘autourl’) == ‘yes’ ? $url = JURI::current() : $url = $params->get(‘url’));

        and there we are. 🙂 thanks, now it looks fine to me

  10. None of this works for me as I am running wordpress with the FACEBOOK SOCIAL PLUGINS and have this error.. I went to a bumch of other sites that also have this plugin and they TOO have the same issue.. how to fix?

  11. No, it is not working. And your FB like button is not working too… I think that FB don’t want us to use this feature for some reason… that’s it.

    Cheers,
    S

  12. Does the button work on here if the post has never been LIKED? if the post HAS been liked before, then the LIKE BUTTON works (at least on my site) but if its a new post, and no LIKES, it does NOT work… HELP! on the facebook BUG report, some people reported it was working again but its NOT for me….

  13. If you are running the Like button on a regular, non CRM powered website, I might have a solution for you. I just had this problem and after some experimentation I think I found the solution. I mean, I know I did, it works for me! I blogged about this so it’s easy to share. let me know if this might’ve worked for you too.
    Cheers.

    http://kirillzubovsky.com/2010/10/07/solution-to-facebook-open-graph-page-could-not-be-reached-problem-with-the-like-button/

    1. Hello,
      Maybe its the theme? You could try using a default theme.If that does not work, try disabling the installed plugins one at a time. This could help narrow down to the issue.

  14. I replaced all the whitespace between the tags with   and it still doesnt work.
    Url linter finds all of the pages except for virtuemart subpages (basket, categories, product details…). These are inaccesible to the linter.
    Since im using the Like button only on my product details page it doesn’t work.
    Og meta tags get generated only on virtuemart subpages.
    Please check out my page source if you can find any problem.

    I’m using Joomla 1.5.22., Virtuemart 1.1.6., template is made in Artisteer.

  15. Also i can’t try Neth’s solution because i cant find the CurrentPageURL() function in default.php

    Am i looking in the right spot (templatename/html/mod_mainmenu/default.php)?

    1. Hi Anze, That’s a tricky one. I have no virtuemart installations currently and would not have been of much assistance. Thanks for catching the issue and posting back. Much appreciated.

      1. Hi,

        I am using standard facebbok like button to our dynamic drupal web page. If i click the like button its like that page and it is showing error also. I dont know why that error is coming, I searched many web based tutorials but i could not able to rectify that error.

        Please help me to solve this.

        The errror i am getting is: The Page at (URL) could not be reached.

        sample url of dynamic page: http://volunteerismdev.photoninfotech.com/node/25/Search

        Thanks in advance.

        Its very urgent issue. Please reply ASAP

        1. Thanks for your reply. now the problem is i want to share my webpage in facebook.

          i can share only title and url but i couldn’t share with image thumbnail. why?

Comments are closed.