如何使Google Chrome浏览器标志“ --allow-file-access-from-files”永久保存?


11

如果要允许本地文件访问Google Chrome中的本地文件,请转到终端并运行

$ google-chrome --allow-file-access-from-files 

Answers:


11

导航到桌面启动器/菜单项,打开google chrome的启动器属性对话框。

它看起来应该像这样:

/usr/bin/google-chrome %U

要使您想要的标志成为永久标志,请将其修改为:

/usr/bin/google-chrome --allow-file-access-from-files

修改后,您可能还需要删除并重新固定图标启动器。修改后,Chrome应该在启用了指定标志的情况下启动。

或者,您可以简单地使用上面的代码创建一个新的启动器,然后使用它来启动chrome。

要检查是否已加载您修改的标志:

$ cat ~/.config/google-chrome/Local\ State

并向上滚动到标题为

"session_restore"

您的标志应列在块中,然后

--flag-switches-begin --flag-switches-end

打开Chrome浏览器并导航到URL

chrome://version/

还应该在

Command Line 

这是google-chrome / chrome标志的列表:

http://peter.sh/experiments/chromium-command-line-switches/


1
@Sam,您应该How can I make that option always be turned on when ever google chrome is executed beyond running a .desktop every time从问题中删除部分内容,因为这会造成混乱。
Web-E

@ Web-E好的听起来不错。
Sam Mercier

3

诸如--allow-file-access-from-files标志/开关之类的不同模式并不适合一般用户使用。因此,您不能使用常规版本永久更改它。这些开关/参数的目的是提供选择。不支持也不推荐使用这些标志,并且必须将它们用作临时标志。

由于您不想使用.desktop文件或更改任何快捷方式。您唯一可以做的就是查看开源代码chorimium

自定义代码并进行构建。然后只有它会以您想要的模式打开。

开关清单 | 资源


这就是我所担心的。我将只使用.desktop。
Sam Mercier

1

Google-chrome和Chromium的功能应相同,区别仅在于多媒体(特别是Flash)和一些文件/文件夹位置(铬而不是google-chrome),请参见http://code.google.com/p/chromium / wiki / ChromiumBrowserVsGoogleChrome

您应该 特别查看https://wiki.archlinux.org/index.php/Chromium_Tip​​s_and_Tweaks

Making it all persistent

You can export your flags from ~/.profile:
export CHROMIUM_USER_FLAGS="--disk-cache-dir=/tmp --disk-cache-size=50000000"

Or add them to /etc/chromium/default:
# Default settings for chromium. This file is sourced by /usr/bin/chromium
#
# Options to pass to chromium
CHROMIUM_FLAGS="--scroll-pixels=200"

Chromium will prefer the user defined flags in CHROMIUM_USER_FLAGS to those defined in
/etc/chromium/default. 

这仅仅是这对我来说,到目前为止工作的事-加CHROME_USER_FLAGS=/etc/skel/.bashrc当笔记本电脑内置
布莱恩Sidebotham
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.