Why does XFBML work everywhere but in Chrome?
Posted
by
Andrei
on Pro Webmasters
See other posts from Pro Webmasters
or by Andrei
Published on 2011-01-12T22:56:16Z
Indexed on
2011/01/12
22:58 UTC
Read the original article
Hit count: 501
I try to add simple Like button to my Facebook Canvas app (iframe). The button (and all other XFBML elements) works in Safari, Firefox, Opera, but in Google Chrome. How can I find the problem?
EDIT1:
This is ERB-layout in my Rails app
<html xmlns:fb='http://www.facebook.com/2008/fbml' xmlns='http://www.w3.org/1999/xhtml'>
...
<body>
...
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: '<%= @app_id %>', status: true, cookie: true, xfbml: true
});
FB.XFBML.parse();
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js#appId=<%=@app_id%>&amp;xfbml=1';
document.getElementById('fb-root').appendChild(e);
}());
FB.XFBML.parse();
</script>
<fb:like></fb:like>
...
JS error message in Chrome inspector:
Uncaught ReferenceError: FB is not defined
(anonymous function)
Uncaught TypeError: Cannot call method 'appendChild' of null
window
(anonymous function)
Probably similar to http://forum.developers.facebook.net/viewtopic.php?id=84684
© Pro Webmasters or respective owner