isHeadlessUI function

bool isHeadlessUI()

Returns true if the browser is running on headless mode.

Implementation

bool isHeadlessUI() {
  var userAgent = window.navigator.userAgent;

  if (userAgent.toLowerCase().contains('headless')) return true;

  return false;
}