Preventing content flashes

Unless has been designed to prevent FOUC and FOOC by inserting content while the DOM is still rendering.

As Unless uses a decoupled approach to guarantee easy implementation, FOUC is a valid concern. Through a smart script design, we prevent Flash Of Unstyled Content.

It works like this: the Unless script will load the personalized content in parallel with your web page. Then, while your web page is still loading like it normally would, we will replace original content with personalizations. So, we replace content before your web page even shows up in your visitors' browsers.

However, to achieve this, there are a few things that have to be taken into account:

  • Include our script as the first javascript in the < head > section of your HTML code. This way you can make sure that the content will be loaded before the DOM starts rendering.
  • Be aware that using Google Tag Manager or another script injection tool, could cause some interference. Tools like GTM insert scripts later in time - even after your web page has been loaded. The Unless script may be triggered too late to prevent FOUC.

If you have any questions or problems, contact us, so we can help you fix it.