How can I launch Chrome with flags from command line more concisely?

谁说我不能喝 提交于 2019-12-02 20:16:15

Just make an alias in your .bashrc or .bash_profile

alias ogc='open -a Google\ Chrome --args --disable-web-security'

And then reload your shell.

exec $SHELL

Now, every time you type ogc (or whatever you want to call it) in your terminal, it will run the full command open -a Google\ Chrome --args --disable-web-security

This work for me:

  1. Modify the .bash_profile
  2. Write this alias:
alias cchrome='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir="/tmp/chrome_dev_session" --disable-web-security'
  1. Run
exec $SHELL
  1. With the cchrome command open a new windows of chrome with the disable web security to solve the "access-control-allow-origin" problem

The Easiest way to Launch Chrome with flags in MAC using terminal is :

'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' --disable-features=CrossSiteDocumentBlockingAlways,CrossSiteDocumentBlockingIfIsolating

Any filter can come after -- in the above code --disable-features=CrossSiteDocumentBlockingAlways,CrossSiteDocumentBlockingIfIsolating is just an example.

Note: Make sure to close all instances of Chrome before running it.

Why not just run a webserver? Open a terminal and type

cd folder_with_html_and_assets
python -m SimpleHTTPServer

Now in your browser to go http://localhost:8000 When your done go to the terminal and press Ctrl-C

That seems much better than disabling your security and risking getting pwnd.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!