Can I host Facebook's all.js locally?
I've been noticing that sometimes my Facebook app runs slow, and when checked it was because the all.js file was not loaded 开发者_如何学Gofrom the Facebook server, so I copied the file ontp my server and tested it.
Everything seems to work fine, and actually it runs faster. My question is - do you know if there are bugs or errors in doing this?
The problem here is that now you're shifting a dependency, and by extension the maintenance of that dependency to your local application. If it's hosted on Facebook's servers, they can update it to fix bugs or add features.
If it's taking a long time to load, you should bring it up on their support forums
Your page has to load the all.js file in any case.
- Facebook servers should be faster than the server which host your website. So, theoretically loading the js file from facebook should be faster.
- A better approach would be to cache the file for some time. This will make the page loads after the initial one much, much faster.
- As people have mentioned, the all.js file is updated constantly with bug-fixes etc. So, it is always better to get the newest version of the file instead of manually updating it on your server after some time.
You can have some problems when the facebook update API. You will need to regularly and frequently (every 5 min?) update the file.
精彩评论