Facebook Like button and weird error

会有一股神秘感。 提交于 2019-12-13 02:39:49

问题


Im trying to implemet Facebook Like with OpenGraph and Im getting weird error:

You must specify an URL as part of this widget or API.

I added Open Graph protocol to meta tags, added < fb:like> tag with URL to that page, added JavaScript SDK init.

Like appears, I click, and that error is shown. Does anyone knows what to do

Thanks


EDIT:

I found error... I'm using FB connect with script: http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php

There is FB.Init and if you want to include some plugin then you can't use FB.Init again, which every plugin request. So if you have few plugins on the same page, then you will have error.

But, with this FeatureLoader.js I cant get FBML to work, only fb:fan works, and for Activity and Like I must use iframe :(

Does anyone know how to get it work with FBML?

Thanks again


回答1:


I also faced the same URL error and after long hours of mind boggling and hit and trial, i was able to make it work. Infact my facebook fan box was showing the currently logged in user's facebook home page instead of fan list. The actual problem was same as mentioned in above comments of the featureloader library. I have written about my problem and the solution here: http://am22tech.com/s/22/Blogs/post/2010/06/01/Facebook-like-box-shows-users-facebook-home-page-instead-of-like-box-content.aspx

Hope it helps others.




回答2:


This error is the result of the href parameter not being specified or being specified incorrectly when calling Facebook's code.

It should look something like this if you're putting this on a standard web page:

<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fstackoverflow.com%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light"
   scrolling="no" frameborder="0"
   allowTransparency="true"
   style="border:none; overflow:hidden; width:450px; height:80px"></iframe>

See the format of src parameter? The parameters called: href, layout, show_faces, width, action, colorscheme have rules for how they are called. Check Like Button for more information. Facebook's Developer Docs are invaluable for doing this kind of thing.




回答3:


We had that error of "You must specify an URL as part of this widget or API."

and found we had been using an out of date facecbook JS include file of

http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php

so if you are trying to get FB like to work and have the above, remove and or update it.



来源:https://stackoverflow.com/questions/2730943/facebook-like-button-and-weird-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!