protected function isOutputHtml()
    {
        static $result;

        if ($result !== null) {
            return $result;
        }

        if ($this->pool->config->getSetting(Fallback::SETTING_DETECT_AJAX) === Fallback::VALUE_FALSE) {
            // We ignore the heades and send everything.
            $result = true;
        }

        // When we have dispatched a PDF or Json, the browser will not be
        // able to render the HTML output correctly.
        foreach (headers_list() as $header) {
            $header = strtolower($header);
            if (strpos($header, 'content-type') !== false &&
                strpos($header, 'html') === false
            ) {
                // We do have none html content type.
                $result = false;
            }
        }

        // Found nothing, must be HTML.
        return $result = true;
    }