2017/10/01

讓chrome 可以讀取 local file

首先,要知道的就是,啟動命令中加上 --allow-file-access-from-files
做法上,有幾個地方可以進行
1. 可以在 ubuntu 快捷圖示修改,檔案在
  ~/.local/share/applications/google-chrome.desktop
  如果已經在的話直接修,否則參考以下內容:
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=Welcome to Chrome - Google Chrome
Icon=google-chrome
Path=/home/wade
Exec=/opt/google/chrome/chrome --allow-file-access-from-files
StartupNotify=false
StartupWMClass=Google-chrome
OnlyShowIn=Unity;
X-UnityGenerated=true

2. 直接修改(如果你有權限的話) 啟動的 google-chrome script
通常是 /usr/bin/google-chrome
複雜的我們就不看了,只看最後一行,我的範例是:
exec -a "$0" "$HERE/chrome" --allow-cross-origin-auth-prompt --allow-file-access-from-files "$@"

3. 或者是修改安裝的目錄,例如 /opt/google/chrome/google-chrome

附註:事實上底下幾個位置是相同的(都是超連結)
/usr/bin/google-chrome
/etc/alternatives/google-chrome
/usr/bin/google-chrome-stable
/opt/google/chrome/google-chrome
最後一個才是普通檔,其他幾個最後都指向它

0 意見: