Is it possible to run Chrome with and without web security at the same time?
I recently found out that I can disable Chrome "web security" using a command line argument, making JavaScript development easier. The issue is that I can't seem to run more than one "instance" of Chrome at a time. If I chrome.exe --disable-web-security
while Chrome is alread running, it just opens a new window within the running instance and ignores my command line arguments. I can close Chrome completely and relaunch it with the above command line argument, but then all my windows will be running without web security, which is a bad thing for general browser usage.
So to summarize the question: Is it possible to start an instance of Chrome with the --disable-web-security
flag while a normal Chrome instance is running?
Note: I suspect the answer may lay within the Chrome command line switches, but there are just... so many...
I found a similar question on Ask Ubuntu. Apparently you can tell Chrome to start a new session by passing it a new user data directory. This means I can now run this command:
chrome.exe --user-data-dir="C:/Chrome dev session" --disable-web-security
And a new Chrome window opens with web security disabled. Yay!
Note: This means that window drag & drop won't work between these two windows.
Close all the opened windows in the Chrome browser. If multiple windows are opened, close everything separately. Then you can open Chrome using the following code in "RUN":
chrome.exe --allow-file-access-from-files --disable-web-security
For Mac:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir="/tmp/chrome_dev_session" --disable-web-security
Replace with your particular path to Chrome if necessary.
Responding to @aug and @hubro's comments, you can use the open
command's -n
flag to open a new instance of an app via Mac OS X's Terminal:
open -n -a /Applications/Chrome.app
You can add any flags that you want to use (like --disable-web-security
) onto the end of that command.