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

In most cases for social media buttons supplied by these web services, you can't. You will typically have to reference a JS library at the position of the document you want to render the button at. You put them after </body> and they'll render in that position in the document. The above tip is smart and works around that by asynchronously updating the DOM when the scripts are ready (i.e., downloaded).

If you meant "put the OP's scripts after the body element" -- yeah, you could do that (at least for sure with GA async code, you can), and that would be a good idea so that you serve and render CSS first, making your pages feel more responsive. But that's not what your comment reads as.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: