Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 from 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?

like image 973
Raul Leaño Martinet Avatar asked Mar 16 '11 18:03

Raul Leaño Martinet


2 Answers

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

like image 58
Joel Martinez Avatar answered Nov 09 '22 17:11

Joel Martinez


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.
like image 25
Gaurav Swaroop Avatar answered Nov 09 '22 15:11

Gaurav Swaroop