Flash of unstyled content

Last updated
FOUC when loading Wikipedia's main page. Wikipedia FOUC.png
FOUC when loading Wikipedia's main page.

A flash of unstyled content (FOUC, or flash of unstyled text) [1] [2] is an instance where a web page appears briefly with the browser's default styles prior to loading an external CSS stylesheet, due to the web browser engine rendering the page before all information is retrieved. [3] The page corrects itself as soon as the style rules are loaded and applied; however, the shift may be distracting. Related problems include flash of invisible text and flash of faux text. [1] [2]

Contents

Technical information

Animation of FOUC, while loading a HTML/CSS page. The header text of the webpage is firstly rendered before the Bootstrap CSS files. Flash of unstyled content (FOUC) while loading a HTML, CSS page.gif
Animation of FOUC, while loading a HTML/CSS page. The header text of the webpage is firstly rendered before the Bootstrap CSS files.

The issue was documented in an article named "Flash of Unstyled Content". [4] At first, FOUC appeared to be a browser problem unique to Internet Explorer but later became apparent in other browsers, [5] [6] and has since been described as "a Safari epidemic". [7]

A flash of unstyled content is indifferent to changes in CSS or HTML versions. This problem, which leaves the core content unaffected, originates from a set of priorities programmed into the browser.[ citation needed ] As the browser collects HTML and all the ancillary files referenced in the markup, the browser builds the Document Object Model on-the-fly. The browser may choose to first display the text so that it can parse the quickest.

Flashes of unstyled content are more prevalent now that HTML pages are more apt to reference multiple style sheets. Web pages often include style references to media other than the browser screen, such as CSS rules for printers and mobile devices. Web pages may import layers of style files, and reference alternative style sheets. Online advertisements and other inserted offsite content, like videos and search engines, often dictate their own style rules within their code block. The cascading nature of CSS rules encourages some browsers to wait until all the style datasets have been collected before applying them.

With the advent of JavaScript libraries such as jQuery which can be employed to further define and apply the styling of a web page, flashes of unstyled content have also become more prominent. In an attempt to avoid unstyled content, front-end developers may choose to hide all content until it is fully loaded, at which point a load event handler is triggered and the content appears, though an interruption of loading might leave behind a blank page, to which unstyled content would be preferable.

To emulate a flash of unstyled content, developers can use browser add-ons that are capable of disabling a web page's CSS on the fly. Firebug and Async CSS are such add-ons. Other techniques include manually stopping a page from completing the loading of CSS components. Another option entails using script-blocking tools.

While, by 2016, several different techniques had been developed to avoid undesired display behaviours, [2] a change in rendering behaviour in Google Chrome version 50, whereby stylesheets injected by JavaScript are prevented from blocking page loading, as required by the HTML5 specification, brought the situation to website creators' attentions again, particularly affecting users of Typekit, a web typography product from Adobe Systems. [1] Within 2 months, Adobe had changed the way in which their fonts were included into third-party websites in order to avoid the undesired rendering behaviour. [8]

See also

Related Research Articles

A browser engine is a core software component of every major web browser. The primary job of a browser engine is to transform HTML documents and other resources of a web page into an interactive visual representation on a user's device.

WebKit is a browser engine developed by Apple and primarily used in its Safari web browser, as well as all web browsers on iOS and iPadOS. WebKit is also used by the PlayStation consoles starting with the PS3, the Tizen mobile operating systems, the Amazon Kindle e-book reader, Nintendo consoles starting with the 3DS Internet Browser, and the discontinued BlackBerry Browser.

Mozilla Firefox has features which distinguish it from other web browsers, such as Google Chrome, Safari, and Microsoft Edge.

Netscape Plugin Application Programming Interface (NPAPI) is a deprecated application programming interface (API) for web browser plugins, initially developed for Netscape Navigator 2.0 in 1995 and subsequently adopted by other browsers.

In computing, quirks mode is an approach used by web browsers to maintain backward compatibility with web pages designed for old web browsers, instead of strictly complying with web standards in standards mode. This behavior has since been codified, so what was previously standards mode is now referred to as simply no quirks mode.

<span class="mw-page-title-main">Progressive enhancement</span> Web design strategy putting emphasis web content first

Progressive enhancement is a strategy in web design that puts emphasis on web content first, allowing everyone to access the basic content and functionality of a web page, while users with additional browser features or faster Internet access receive the enhanced version instead. This strategy speeds up loading and facilitates crawling by web search engines, as text on a page is loaded immediately through the HTML source code rather than having to wait for JavaScript to initiate and load the content subsequently, meaning content ready for consumption "out of the box" is served immediately, and not behind additional layers.

A CSS hack is a coding technique used to hide or show CSS markup depending on the browser, version number, or capabilities. Browsers have different interpretations of CSS behavior and different levels of support for the W3C standards. CSS hacks are sometimes used to achieve consistent layout appearance in multiple browsers that do not have compatible rendering. Most of these hacks do not work in modern versions of the browsers, and other techniques, such as feature support detection, have become more prevalent.

Scalable Inman Flash Replacement (sIFR) is an obsolete JavaScript and Adobe Flash dynamic web fonts implementation, enabling the replacement of text elements on HTML web pages with Flash equivalents. It is open-source and was initially developed by Mike Davidson and improved by Mark Wubben. It is a scalable variety of HTML text-to-flash replacement pioneered by Shaun Inman.

<span class="mw-page-title-main">Firebug (software)</span> Web development add-on for Firefox

Firebug is a discontinued free and open-source web browser extension for Mozilla Firefox that facilitated the live debugging, editing, and monitoring of any website's CSS, HTML, DOM, XHR, and JavaScript.

<span class="mw-page-title-main">Web typography</span> Publishing considerations for the Web

Web typography, like typography generally, is the design of pages – their layout and typeface choices. Unlike traditional print-based typography, pages intended for display on the World Wide Web have additional technical challenges and – given its ability to change the presentation dynamically – additional opportunities. Early web page designs were very simple due to technology limitations; modern designs use Cascading Style Sheets (CSS), JavaScript and other techniques to deliver the typographer's and the client's vision.

<span class="mw-page-title-main">Google Chrome</span> Web browser developed by Google

Google Chrome is a web browser developed by Google. It was first released in 2008 for Microsoft Windows, built with free software components from Apple WebKit and Mozilla Firefox. Versions were later released for Linux, macOS, iOS, and also for Android, where it is the default browser. The browser is also the main component of ChromeOS, where it serves as the platform for web applications.

<span class="mw-page-title-main">Chromium (web browser)</span> Open-source web browser project

Chromium is a free and open-source web browser project, primarily developed and maintained by Google. It is a widely-used codebase, providing the vast majority of code for Google Chrome and many other browsers, including Microsoft Edge, Samsung Internet, and Opera. The code is also used by several app frameworks.

<span class="mw-page-title-main">CSS</span> Style sheet language

Cascading Style Sheets (CSS) is a style sheet language used for specifying the presentation and styling of a document written in a markup language such as HTML or XML. CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript.

The Web Open Font Format (WOFF) is a font format for use in web pages. WOFF files are OpenType or TrueType fonts, with format-specific compression applied and additional XML metadata added. The two primary goals are first to distinguish font files intended for use as web fonts from fonts files intended for use in desktop applications via local installation, and second to reduce web font latency when fonts are transferred from a server to a client over a network connection.

Modern HTML5 has feature-parity with the now-obsolete Adobe Flash. Both include features for playing audio and video within web pages. Flash was specifically built to integrate vector graphics and light games in a web page, features that HTML5 also supports.

Content Security Policy (CSP) is a computer security standard introduced to prevent cross-site scripting (XSS), clickjacking and other code injection attacks resulting from execution of malicious content in the trusted web page context. It is a Candidate Recommendation of the W3C working group on Web Application Security, widely supported by modern web browsers. CSP provides a standard method for website owners to declare approved origins of content that browsers should be allowed to load on that website—covered types are JavaScript, CSS, HTML frames, web workers, fonts, images, embeddable objects such as Java applets, ActiveX, audio and video files, and other HTML5 features.

<span class="mw-page-title-main">Brackets (text editor)</span> Editor for web development

Brackets is a source code editor with a primary focus on web development. Created by Adobe Inc., it is free and open-source software licensed under the MIT License, and is currently maintained on GitHub by open-source developers. It is written in JavaScript, HTML and CSS. Brackets is cross-platform, available for macOS, Windows, and most Linux distributions. The main purpose of Brackets is its live HTML, CSS and JavaScript editing functionality.

Adobe Edge is a discontinued suite of web development tools that Adobe Inc. started developing in 2011. The tools enhances the capabilities of other Adobe apps, such as Dreamweaver. The first app in the suite was the eponymous Adobe Edge, released in August 2011 as a multimedia authoring tool designed to succeed the Flash platform. In September 2012, Adobe renamed the app Edge Animate, and announced Edge Reflow, Edge Code, and Edge Inspect. Also packaged with the suite are Edge Web Fonts, the PhoneGap app, and an Adobe Typekit subscription. In October 2015, Adobe announced an end to the development of the Edge family. By the end of September 2019, all Adobe Edge products were removed from the Creative Cloud offering.

Google Chrome Experiments Online showroom of web browser based experiments

Google Chrome Experiments is an online showroom of web browser based experiments, interactive programs, and artistic projects. Launched on March 1, 2009, Google Chrome Experiments is an official Google website that was originally meant to test the limits of JavaScript and the Google Chrome browser's performance and abilities. As the project progressed, it took the role of showcasing and experimenting latest open-source web-based technologies, such as JavaScript, HTML5, WebGL, Canvas, SVG, CSS, and some others. All the projects on Chrome experiments are user submitted and are made using open source technologies. As of February 24, 2015, there were 1,000 different Chrome projects posted on the website.

Front-end web development is the development of the graphical user interface of a website through the use of HTML, CSS, and JavaScript so users can view and interact with that website.

References

  1. 1 2 3 Tim Brown (3 June 2016). "Regarding the Flash of Unstyled Text in Chrome 50". Adobe Typekit blog. Adobe Systems. Archived from the original on Sep 1, 2016. Retrieved 9 August 2016.
  2. 1 2 3 Coyier, Chris (1 April 2015). "FOUT, FOIT, FOFT". CSS Tricks. Archived from the original on 15 August 2020. Retrieved 9 August 2016.
  3. Boudreaux, Ryan (October 18, 2013). "How to prevent Flash of Unstyled Content on your websites". TechRepublic. Archived from the original on 2021-03-05. Retrieved 2021-10-09.
  4. "Flash of Unstyled Content (FOUC)". Blue Robot. 2001. Archived from the original on May 13, 2015. Retrieved 12 October 2012.
  5. Winner, Judith (2010-04-19). "Flash of Unstyled Content (FOUC)". Bugzilla@Mozilla. Archived from the original on 5 November 2016. Retrieved 14 October 2016.
  6. "Chromium Bugs containing 'FOUC'". bugs.chromium.org. Archived from the original on 18 October 2016. Retrieved 14 October 2016.
  7. Dave Hyatt (1 September 2006). "The FOUC Problem". Surfin' Safari. The WebKit Open Source Project. Archived from the original on 30 August 2012. Retrieved 16 October 2012. The FOUC problem would normally be a minor occurrence. However with the advent of Google AdSense, FOUC has become a Safari epidemic. Because these Google ads not only execute inline script but access layout information that they often don't even end up using in the page, the problem of FOUC is much more severe than it should be.
  8. Bram Stein (28 July 2016). "Changes to web font serving on Typekit". Adobe Typekit blog. Adobe Systems. Archived from the original on 15 August 2016. Retrieved 9 August 2016.