jashkenas/coffee-script — Issue #2082: problem with facebook javascript sdk
Author: WitzHsiao
Created: 2012-01-31 06:51:45+00:00
State: open

I try to develop facebook app with coffeescript, and I got problem in the following.
The error is Uncaught TypeError: Object [object DOMWindow] has no method 'fbAsyncInit'

This is my code below.
window.fbAsyncInit ->
FB.init({
appId: 'APP_ID',
status: true,
cookie: true,
xfbml: true
})

((d) ->
id= 'facebook-jssdk'
if d.getElementById(id)
return
js = d.createElement('script')
js.id = id
js.async = true
js.src = "//connect.facebook.net/en_US/all.js"
d.getElementByTagName('head')[0].appendChild(js)
)(document)