【发布时间】:2011-07-16 21:55:49
【问题描述】:
有时我在加载http://connect.facebook.net/en_US/all.js 时遇到“FB 未定义”问题
我意识到问题在于有时我的网站无法加载该文件。所以它什么也得不到,而且对象 FB 根本不存在。
我的解决方案是在发生这种情况时阻止我的用户,所以我在 JavaScript 中尝试了以下代码,但似乎没有一个有效:
if (FB) {/*run the app*/} else {/*alert the user*/}
if (FB!==false) {/*run the app*/} else {/*alert the user*/}
if (FB!='undefined') {/*run the app*/} else {/*alert the user*/}
感谢您的回答!
【问题讨论】:
标签: javascript facebook