为什么我的 Facebook Like 按钮会出现此错误?
Uncaught ReferenceError: _onloadHook is not defined
为什么?我的代码如下:
<!DOCTYPE html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<html>
<head>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<script type="text/javascript">
//Initialize facebook
FB.init({
appId : '12345',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
channelUrl : 'http://www.abc.com/channel.html', // channel.html file
});
</script>
</head>
<body>
<div id="fb-root"></div>
<fb:send href="http://abc.com/blah" font="lucida grande" ref="codes_popup"></fb:send>
<fb:send href="http://abc.com/blah" font="lucida grande" ref="codes_popup"></fb:send>
</body>
</html>
编辑:当我有多个时,就会发生这种情况。当我只有一个“发送”按钮时,错误不存在。
对于每个额外的“发送”按钮,都会发生错误。
Uncaught ReferenceError: _onloadHook is not defined
Why? My code is below:
<!DOCTYPE html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<html>
<head>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<script type="text/javascript">
//Initialize facebook
FB.init({
appId : '12345',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
channelUrl : 'http://www.abc.com/channel.html', // channel.html file
});
</script>
</head>
<body>
<div id="fb-root"></div>
<fb:send href="http://abc.com/blah" font="lucida grande" ref="codes_popup"></fb:send>
<fb:send href="http://abc.com/blah" font="lucida grande" ref="codes_popup"></fb:send>
</body>
</html>
Edit: When I have multiple this will happen. When I only have one "send" button , the error is not there.
For every extra "Send" button, the error occurs.
发布评论
评论(4)
这是 Facebook 平台中的一个错误;它已被报告为 bug #20041。
This is a bug in the Facebook Platform; it has already been reported as bug #20041.
将 Facebook JS 库和 JS 代码脚本放置在
fb-root
div 下:Place the Facebook JS library and JS code scripts under the
fb-root
div:我今天遇到了完全相同的错误。
正如 ifaour 提到的,FB 文档说您需要将 FB
标记放在
< /代码>。然而,在他的示例和 FB 文档中,他们将脚本直接放在
下。我正在这样做,但仍然收到OP提到的错误。我终于能够通过将 FB
标记移动到页面的最底部、关闭