We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25357
    • 92 Posts
    I know this really looks like a Facebook problem and maybe it is somehow - but it only happens when I try to drop a widget into a modX document.

    PROBLEM: In Revo, and only when placed within Revo, a double slash is added for any resource URL causing the "Like" widget to return the #$%#$% "The url cannot be reached" error. I’ve tested it with a static file placed in document root and it doesn’t do it - even though this sounds like a FB problem, it’s only when I place the widget in a modX resource.

    Man this is driving me nuts. I’m hoping someone can see what I’m doing wrong, been searching at poking at it for three hours (bigger stick required?).

    Revo 2.0.8pl adv, CentOS server, working only in FF, everything else functions properly.

    .htaccess - you will see it’s a little more efficient version of the usual.

    RewriteEngine On

    # both WITH and WITHOUT RewriteBase set to /

    RewriteCond %{REQUEST_URI} !^\/*manager\/*$
    RewriteRule ^([^.]+)$ index.php?q=$1 [L,QSA]

    Base:
    <base href="[[++site_url]]">
    Correctly resolves to example.com/ = and yeah, slash noted. Looked everywhere for places it was possibly doubling it up, but isn’t.

    FB code:
    <iframe src="http://www.facebook.com/plugins/like.php?href=[[++site_url]][[~[[*id]]]]&amp;layout=standard&amp;show_faces=true&amp;width=240&amp;action=like&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:240px; height:80px;" allowTransparency="true"></iframe>

    href correctly resolves to example.com/test-page

    As soon as you hit "Like" you can see the widget reports the URL as "example.com//test-page" and it returns the error.

    What else I’ve tried:

    Static file, to example.com/wtf.html, which of course, works just fine.
    Removing base href
    Encoding / as %2f
    Both the iframe and the XFBML methods
    A dozen other tweaks I can’t even remember

    When I hit "like" Live HTTP Headers shows we’re sending the correct url, one slash for both the href and the referer (edited):

    .....
    href=http%3A%2F%2Fwww.example.com%2Ftest-page&node_type=link&edge_type=like&page_id&layout=standard&is_personalized=false&connect_text=0&ref&now_connected=true&post_form_id=cf54be0fbd8a20792c7116fd39156074&iframe_referer=http%3A%2F%2Fwww.example.com%2Ftest-page&scrap......

    So I don’t know what’s up, anyone got any ideas where to look next?

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Maybe it’s not the same thing (I don’t have a Facebook account and so know little about it) but the Like button I use doesn’t link to a page on the client site at all.
      <iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2Fedit%2F%3Fid%3D...%26sk%3Dbasic%23%21%2Fpages%2F...%2F...&layout=box_count&show_faces=false&width=60&action=like&font=verdana&colorscheme=light&height=60" scrolling="no" style="border:none; overflow:hidden; width:60px; height:60px;" allowTransparency="true"></iframe>
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 21106
        • 53 Posts
        I’ve used Facebook’s like button using the simpler XFBML version:

        <fb:like href="" send="true" layout="button_count" show_faces="false" action="recommend" font="arial"></fb:like>

        I believe FB automatically determine the URL if you leave the href blank. As for the URL, instead of using [[++siteurl]]][[~[[*id]]]], i use http://www.myurl.com/[[~[[*id]]]]. I used it in implementing FB comments box on my blog.