1

How can i turn off cookie prompts and disallow cookies in the Lynx browser?

Here is my .lynxrc:

ACCEPT_ALL_COOKIES:FALSE
SET_COOKIES:FALSE

Thanks

3 Answers 3

3

That's the wrong syntax for .lynxrc (it's correct for lynx.cfg—the two files use different format).

The documentation for the features in lynx.cfg is extracted from its comments into the website:

  • ACCEPT_ALL_COOKIES (website):

    ACCEPT_ALL_COOKIES – Cookies Description

    If ACCEPT_ALL_COOKIES is set TRUE, Lynx will accept cookies from all domains with no user interaction. This is equivalent to automatically replying to all cookie 'Allow?' prompts with "A"lways. Note that it does not preempt validity checking, which has to be controlled separately (see below). The default is defined in userdefs.h and can be overridden here, or in the .lynxrc file via an o(ptions) screen setting. It may also be toggled via the -accept_all_cookies command line switch. Default value

    ACCEPT_ALL_COOKIES:FALSE

  • versus lynx.cfg

    .h2 ACCEPT_ALL_COOKIES
    # If ACCEPT_ALL_COOKIES is set TRUE, Lynx will accept cookies from all
    # domains with no user interaction.  This is equivalent to automatically
    # replying to all cookie 'Allow?' prompts with 'A'lways.  Note that it
    # does not preempt validity checking, which has to be controlled separately
    # (see below).
    # The default is defined in userdefs.h and can be overridden here, or
    # in the .lynxrc file via an o(ptions) screen setting.  It may also be
    # toggled via the -accept_all_cookies command line switch.
    #
    #ACCEPT_ALL_COOKIES:FALSE
    

Because .lynxrc is written by the program, there is no need to manually edit it. Initially (through the 1990s) Lynx settings were either in lynx.cfg or .lynxrc, with no overlap. That was intentional, since Lynx was often used in a kiosk configuration where the user was prevented from changing settings that were intended to be the same for all users. Later, other developers added features that they intended to be in both the system- and user-configurable files. Still later (in 2001), the ENABLE_LYNXRC feature was introduced to allow users to save any setting. However, the cookie configuration dates from that interim period, as you can see by the customized comment in the .lynxrc file which Lynx would save from the Options menu:

# accept_all_cookies allows the user to tell Lynx to automatically
# accept all cookies if desired.  The default is "FALSE" which will
# prompt for each cookie.  Set accept_all_cookies to "TRUE" to accept
# all cookies.
accept_all_cookies=off
5
  • 3
    Perhaps it's just my reading comprehension skills, but you have two bullet points that you want to contrast ("a versus b") but they both appear to demonstrate the same syntax. Did you mean to mvoe the "accept_all_cookies=off" block into the second "versus" block? (Both "a versus b" talk about lynx.cfg)
    – Jeff Schaller
    Jul 26, 2020 at 13:02
  • 2
    No, I was pointing out where the documentation for ACCEPT_ALL_COOKIES comes from, and in quoting it, the reader might notice the mention of the options-menu. Following the bullets, I pointed out how .lynxrc differs from lynx.cfg (there's more than two points in the answer). Jul 26, 2020 at 13:30
  • I followed your advice and used the Options menu and turned off cookies and saved to disk which created a .lynxrc file in my home directory. However after restarting lynx. I am still prompted for each cookie. I am trying to prevent the prompt from showing up and want to decline all cookies. Is that possible? Thanks.
    – Dan
    Jul 27, 2020 at 6:59
  • offhand - depending on the version of Lynx, the cookies might not pass its check for valid cookies and cause the prompt. The mailing list is better suited for digging into that Jul 27, 2020 at 19:54
  • 3
    oh i see, so what i ended up doing is creating an alias for lynx and have it call this: lynx -accept_all_cookies -cookie_file=/dev/null that way the cookies are all accepted by default but sent to /dev/null so they never get written to disk. i am running Lynx Version 2.9.0dev.5 (27 Feb 2020) libwww-FM 2.14, SSL-MM 1.4.1, GNUTLS 3.6.13, ncurses 6.2.20200212(wide)
    – Dan
    Jul 28, 2020 at 5:35
1

SET_COOKIES:FALSE does the trick on Lynx Version 2.9.0dev.5 (27 Feb 2020).

If you wish to use your own lynx.cfg, and you are on bash, you need to update .profile and add the following line. You can also execute it directly on the command prompt.

LYNX_CFG=~/lynx.cfg; export LYNX_CFG

Then ~/lynx.cfg, will look like

#includes the default lynx config (Debian distro)
INCLUDE:/etc/lynx/lynx.cfg

SET_COOKIES:FALSE
-1

It looks likes lynx's documentation is completely outdated.

~/.lynxrc must contain:

accept_all_cookies=off

Here's how I've found it out. Please delete ~/.lynxrc, run lynx, press O, and then configure it (don't forget to mark the checkbox: Save options to disk).


The utility and its documentation are completely messed up: I've read the sources and accept_all_cookies only accepts TRUE and FALSE both of which are not what the OP is looking for.

There's also the cookie_reject_domains option but it doesn't accept wildcards:

# Note that in order to match cookies, domains have to be spelled out exactly
# in the form in which they would appear on the Cookie Jar page (case is
# insignificant).  They are not wildcards.  Domains that apply to more than
# one host have a leading '.', but have to match *the cookie's* domain
# exactly.

In short, you may want to fix the utility and send them a patch.

2
  • i was using stackoverflow.com to test the cookie behavior and after using this method, i was still prompted for the cookie. which version of lynx are you using?
    – Dan
    Jul 28, 2020 at 5:36
  • 1
    Lynx is broken, even its latest development snapshot lynx2.8.9rel.1.tar.bz2. There's no way to make it not accept cookies for all sites without a prompt. Jul 28, 2020 at 6:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .