47

I'm trying to do a simple test without changing any server-side code involving a cross-domain AJAX call, and I was wondering if it's possible to use --disable-web-security anymore. It seems to not work on Chrome 28.

I haven't used it since Chrome version 21; has this feature been dropped?

Super Jade
  • 5,609
  • 7
  • 39
  • 61
Fields
  • 687
  • 1
  • 6
  • 13

12 Answers12

46

Check your windows task manager and make sure you kill all chrome processes before running the command.

Jason Gotti
  • 484
  • 5
  • 5
  • That did it. I just forgot to kill one chrome process. – Fields Sep 23 '13 at 21:33
  • With the current Chrome it doesn't matter. I am browsing with enabled security while e2e testing with disabled security in a different window using Karma... – inf3rno Sep 25 '18 at 17:09
  • Get call happening in the network tab but it is blocking post call with web security disabled. If you find any solution for the same please let here know. Thanks – Harsha Javalkar Aug 30 '22 at 17:49
41

The new tag for recent Chrome and Chromium browsers is :

--disable-web-security --user-data-dir=c:\my\data
Pavel Chuchuva
  • 22,633
  • 10
  • 99
  • 115
Pritam Banerjee
  • 17,953
  • 10
  • 93
  • 108
  • 3
    This is working, using only --disable-web-security doesn't. – Mr Br May 05 '16 at 08:20
  • 4
    On the second param, be sure to specify a path, like `--user-data-dir=c:\my\data` – GrandmasterB May 08 '16 at 06:36
  • let's say I want to enable web security again. How can I do it? – a.barbieri Sep 21 '17 at 16:11
  • 2
    The `user-data-dir` flag is now mandatory when trying to disable web security, because it effectively launches a second Chrome "profile". You can run a normal ("with" web security) profile by just launching Chrome with no command line flags, and this "good" session can run at the same time as the unprotected session. – Coderer Jul 08 '20 at 09:18
  • It isn't working for me. It still says it can't load a file due to strict mime type checking for module scripts, "per HTML spec". – trusktr Feb 09 '23 at 02:25
25

Try this :

Windows:

Run below commands in CMD to start a new instance of chrome browser with disabled security

Go to Chrome folder:

cd C:\Program Files (x86)\Google\Chrome\Application

Run below command:

chrome.exe --disable-web-security --user-data-dir=c:\my-chrome-data\data

MAC OS:

Run this command in terminal:

open -n -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --user-data-dir="/tmp/chrome_dev_sess_1" --disable-web-security

Hope this will help both Windows & Mac users!

CodeChanger
  • 7,953
  • 5
  • 49
  • 80
14

This flag worked for me at v30.0.1599.101 m enter image description here

The warning "You are using an unsupported command-line flag" can be ignored. The flag still works (as of Chrome v86).

Kijewski
  • 25,517
  • 12
  • 101
  • 143
CSSian
  • 1,621
  • 13
  • 19
10

This should work. You may save the following in a batch file:

TASKKILL /F /IM chrome.exe
start chrome.exe --args --disable-web-security
pause
Phylogenesis
  • 7,775
  • 19
  • 27
Zahran
  • 419
  • 4
  • 10
  • got a mac version? – SuperUberDuper Jun 19 '20 at 19:16
  • 3
    In case anybody finds this in 2020 and beyond: this is no longer valid. `disable-web-security` now has no effect if you don't also specify `user-data-dir` -- you can't disable web security on your default profile. – Coderer Jul 08 '20 at 09:20
4

Open target location of chrome and navigate through cmd type

chrome.exe --disable-web-security --user-data-dir=c:\my\dat

Gajender Singh
  • 1,285
  • 14
  • 13
3

Just create this batch file and run it on windows. It basically would kill all chrome instances and then would start chrome with disabling security. Save the following script in batch file say ***.bat and double click on it.

TASKKILL /F /IM chrome.exe
start chrome.exe --args --disable-web-security –-allow-file-access-from-files
Pritam Banerjee
  • 17,953
  • 10
  • 93
  • 108
Zahran
  • 419
  • 4
  • 10
  • Says invalid agrument start – Mukus Jul 12 '15 at 22:46
  • Please try this in a file batch (I should have introduced a new line before start): TASKKILL /F /IM chrome.exe start chrome.exe --args --disable-web-security pause – Zahran Jul 14 '15 at 16:30
  • I did it in a batch file. No worries though. I can open up task manager and kill the process tree for chrome – Mukus Jul 14 '15 at 22:50
2

Check if you have Chrome App Launcher. You can usually see it in your toolbar. It runs as a second instance of chrome, but unlike the browser, it auto-runs so is going to be running whenever you start your PC. Even though it isn't a browser view, it is a chrome instance which is enough to prevent your arguments from taking effect. Go to your task manager and you will probably have to kill 2 chrome processes.

Peter Drinnan
  • 4,344
  • 1
  • 36
  • 29
1

As you can't run --disable-web-security and a normal chrome in parallel it's probably a good solution to use Opera for --disable-web-security

Here is how to create a launcher for opera on windows. By the way, Opera has the same debugging tools as chrome!

http://www.opera.com/

:: opera-browse-dangerously.bat
cd c:\Program Files\Opera\
launcher.exe --disable-web-security --user-data-dir="c:\opera-dev"

PS: Opera doesn't display any notification when started without web-security

Mirko
  • 1,014
  • 9
  • 11
0

If you want to automate this: Kill chrome from task Manager First. In Windows - Right Click (or Shift+right click, in-case of taskbar) on Chrome Icon. Select Properties. In "Target" text-box, add --disable-web-security flag.

So text in text-box should look like

C:\Users\njadhav\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --disable-web-security

Click Ok and launch chrome.

Shubham Jain
  • 16,610
  • 15
  • 78
  • 125
Nitin Jadhav
  • 6,495
  • 1
  • 46
  • 48
0

just run this command from command prompt and it will launch chrome instance with CORS disabled:

C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --disable-gpu --user-data-dir=~/chromeTemp
CodeChanger
  • 7,953
  • 5
  • 49
  • 80
Manoj Verma
  • 518
  • 1
  • 5
  • 12
0

Automated solution for Windows 10

  1. Right-click on Chrome icon > right-click Google Chrome > Properties

Windows 10 toolbar > right-click Chrome icon > right-click Google Chrome > Properties

  1. Shortcut > Target > "C:\Program Files\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir="C:\ChromeDevSession"

Shortcut > Target > "C:\Program Files\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir="C:\ChromeDevSession"

Notes:

  • Your file path for chrome.exe may vary.
  • Also, the --user-data-dir flag is required, and its file path may vary. Besides C:\ChromeDevSession, another possible location is ~/chromeTemp
  1. Now Chrome always has its web security disabled :-)
Super Jade
  • 5,609
  • 7
  • 39
  • 61