Hacker News new | past | comments | ask | show | jobs | submit login

Respectfully disagree with point 3 - "Doing unnecessary XHR requests on page load".

It's better to have your main app page completely static so it can be cached. That said, don't use ajax either - load the initial data via its own script tag.




Doesn't that also involve an extra HTTP call? I discussed the same issue as OP a while ago: http://branchandbound.net/blog/web/2012/11/unify-server-side...

Someone in the comments there mentioned a nice alternative to embeddding the data in a <script> tag to avoid the problem jashkenas raised (</script> in the JSON). Namely, setting it in a data- attribute.


Still, optimizing the initial load is a good idea for applications like this. As an alternative, you could create an API service that returns all relevant information for the first page view in one block, instead of half a dozen smaller AJAX requests.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: