开发者

Facebook 'Like' Social Plugin Ampersand Error

开发者 https://www.devze.com 2023-02-16 23:54 出处:网络
I\'m trying to implement the facebook \'like\' button my site, but I\'m having a problem when my URL has an \"&\" in it.I have tried using htmlentities, as well as urlencode (which is the closest

I'm trying to implement the facebook 'like' button my site, but I'm having a problem when my URL has an "&" in it. I have tried using htmlentities, as well as urlencode (which is the closest to working, but not quite).

I have a url like: example.com/entry.php?id=1&refer=abc, and I url encode the entire thing for the href for the iframe for the social plugin button, which becomes: example.com%2Fentry.php%3Fid%3D1%26refer%3Dabc

Now, when I load the page w开发者_如何学Goith this like button, and click "like" it shows me the correct url "example.com/entry.php?id=1&refer=abc" but then it says Error next to it, click the error message and I get this error:

The page at example/entry.php?id=1&refer=abc could not be reached.

So for some reason it is interpreting the & as an &amp, how does this make any sense?

Thoughts?


What I would do is use the XFBML version and make use of the Open Graph Meta Tags so that you set the url in the og:url meta tag and leave the href empty!

When all is done, run link over the URL Linter to clear the Facebook cache.

0

精彩评论

暂无评论...
验证码 换一张
取 消