Issue link: https://read.uberflip.com/i/1146286
60 | Chapter 8: Rule 8: Make JavaScript and CSS External In these pages, the JavaScript and CSS are loaded twice into the page (inline then external). To work, your code has to deal with double definition. Scripts, for exam- ple, can define but can't execute any functions (at least none that the user notices). CSS that uses relative metrics (percentages or em) may be problematic if applied twice. Inserting these components into an invisible IFrame is a more advanced approach that avoids these problems. Dynamic Inlining If a home page server knew whether a component was in the browser's cache, it could make the optimal decision about whether to inline or use external files. Although there is no way for a server to see what's in the browser's cache, cookies can be used as an indicator. By returning a session-based cookie with the compo- nent, the home page server can make a decision about inlining based on the absence or presence of the cookie. If the cookie is absent, the JavaScript or CSS is inlined. If the cookie is present, it's likely the external component is in the browser's cache and external files are used. The "Dynamic Inlining" example demonstrates this technique.

