在仅有的少数列出了Chrome启动参数的文章中(基本是通过代码自动化分析Chrome源码实现的),我们可以看到有一个参数–disable-cookie-encryption能够控制Cookie是否加密(Whether cookies stored as part of user profile are encrypted):
By default, the cookie store on disk is encrypted in Chromium. Use this switch to disable the encryption for testing purpose (e.g. sharing the cookie store between different systems).
但是,直接设置这个参数实际是无效的,例如就有人在Chrome论坛中询问过这个问题,但未收到有效的解答(https://support.google.com/chrome/forum/AAAAP1KN0B0_pczBvq9m5Q):
观察Chrome源码,可以看到disable-cookie-encryption实际是headless模式下的开关,只有在headless模式下才生效:
实测在headless模式下能够达到禁用Cookie加密的目的:
参考资料:
1、https://nwjs.readthedocs.io/en/nw32/References/Command%20Line%20Options/#-disable-cookie-encryption
2、https://cs.chromium.org/chromium/src/headless/app/headless_shell_switches.cc?sq=package:chromium&type=cs&g=0&l=16
转载时请保留出处,违法转载追究到底:进城务工人员小梅 » 解决Chrome浏览器无法通过–disable-cookie-encryption禁用Cookie加密的问题