Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am trying to optimize my front end code as much as possible and one thing I want to do is be able to set a cookie for people who have already visited so load the css from cache a bit like what is happening on:
http://www.filamentgroup.com/lab/font-events.html
in SSI they use:
<!--#if expr="$HTTP_COOKIE=/fonts\-loaded\=true/" --> <html lang="en" class="fonts-loaded"> <!--#else --> <html lang="en"> <!--#endif -->
Is there a way I can do something equivalent in umbraco with razor?
You could do something like:
@{ var cookie = Request.Cookies["fonts-loaded"]; bool fontsLoaded = cookie != null && cookie.Value == "true"; } <html lang="en" @Umbraco.If(fontsLoaded, "class=\"fonts-loaded\"")>
This assumes you have set a cookie called "fonts-loaded" with a string called "true" elsewhere.
Thanks that works perfectly :) thanks
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Creating cookies for Critical CSS and fonts
I am trying to optimize my front end code as much as possible and one thing I want to do is be able to set a cookie for people who have already visited so load the css from cache a bit like what is happening on:
http://www.filamentgroup.com/lab/font-events.html
in SSI they use:
Is there a way I can do something equivalent in umbraco with razor?
You could do something like:
This assumes you have set a cookie called "fonts-loaded" with a string called "true" elsewhere.
Thanks that works perfectly :) thanks
is working on a reply...