MyBB Internal: One or more warnings occured. Please contact your administrator for assistance.
In-Lining CSS on First Page View
Current time: 02-25-2021, 09:57 AM Hello There, Guest! (LoginRegister)

Post Reply 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
In-Lining CSS on First Page View
02-26-2015, 12:43 AM
Post: #1
In-Lining CSS on First Page View

I was wondering what people's thoughts are on doing this:

- Inline ALL CSS on first page view (or until the user has it in their cache - can have an AJAX call to the server letting the server know this is complete)
- On that same page view, have the last event that takes place (besides the AJAX call) download an external CSS stylesheet with the same CSS that was inlined so that it is cached for future calls
- On future page views, serve the CSS as an async stylesheet in the HTML HEAD section (which should be cached at that point)

I was doing this just for CRITICAL CSS but I was having rendering above the fold issues that went away when I placed all css in the head inlined.

Initial thought on this procedure is that what if the user clears cache? Well, the cookie that stores the session variables (including the one that the ajax call would set) would be cleared. So what if the user clears cached images and files but not cookies? It would be rare but it could happen. However, since the CSS is async in the HTML HEAD, it would just download it again. Some people say it might defeat the purpose but it is rare that somebody would clear cache and then continue to use the website on that same visit. Future visits would have cookies expired.

How much critical CSS is too much CSS though to put in HTML HEAD as inline? At what point does this method become user un-friendly? Thoughts?

Travis Walters
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
In-Lining CSS on First Page View - - 02-26-2015 12:43 AM

Forum Jump:

User(s) browsing this thread: 1 Guest(s)