admin管理员组文章数量:1252714
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?
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?
Share Improve this question edited Mar 16, 2011 at 18:50 Yi Jiang 50.1k16 gold badges138 silver badges136 bronze badges asked Mar 16, 2011 at 18:48 Raul Leaño MartinetRaul Leaño Martinet 2,1136 gold badges29 silver badges44 bronze badges 4- 2 pretty sure that's against TOS. also, you don't get updates, etc. also, your host is faster than FB? that's a really nice server you got there then :) – AlfaTeK Commented Mar 16, 2011 at 18:54
- i dunno if the server runs faster, but it.s obvious that now the app runs faster, maybe because it doesn.t have to search for the file in another server – Raul Leaño Martinet Commented Mar 16, 2011 at 19:08
- Maybe for you it's faster. But considering that your website will be in a server somewhere in the world, FB has much better world-balancing, world-caching, etc... I'm not sure, but I predict this will be against TOS. – AlfaTeK Commented Mar 16, 2011 at 20:10
- I'd imagine that it's cached by the end users browser anyway so it's only obtained on first load. And they probably already have it from previous visits to the site. When you load your site check the get requests - what's the code for the .js file the second time round? It's probably 304, not modified and so not (re)loaded. – Paul Collingwood Commented Nov 7, 2012 at 16:38
3 Answers
Reset to default 5The 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.
本文标签: javascriptCan I host Facebook39s alljs locallyStack Overflow
版权声明:本文标题:javascript - Can I host Facebook's all.js locally? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740316622a2260431.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论