Does --disable-web-security work in Chrome?
Asked Answered
C

12

49

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?

Chromolithograph answered 16/7, 2013 at 14:32 Comment(0)
E
49

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

Edify answered 14/8, 2013 at 17:17 Comment(4)
That did it. I just forgot to kill one chrome process.Chromolithograph
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...Maure
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. ThanksMahau
Similarly on MacOS, remember closing all the Chrome windows alone will not fully quit Chrome— you also need to go to the application menu or icon and select "quit".Ferric
K
44

The new tag for recent Chrome and Chromium browsers is :

--disable-web-security --user-data-dir=c:\my\data
Ketchum answered 29/4, 2016 at 13:29 Comment(4)
This is working, using only --disable-web-security doesn't.Eosin
let's say I want to enable web security again. How can I do it?Carbohydrate
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.Regulate
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".Viniculture
A
29

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!

Aurita answered 24/10, 2019 at 12:44 Comment(5)
Mac one does not work. Almost tried everything after first trying the above one. --disable-site-isolation-trials -> does not work --disable-gpu -> does not work Tried opera also -> no luckCircumrotate
Which MAC OS you have ?Aurita
im on catolina, any luck?Muncey
Mac command works for me on Big Sur. Not sure if it's a factor, but Chrome was not running when I entered the command. For what it's worth: Chrome then acted as if it were being installed for the first time.Glossator
How to do in Linux?Dali
S
16

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).

Shaftesbury answered 6/11, 2013 at 20:5 Comment(0)
C
11

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
Calamint answered 14/7, 2015 at 16:32 Comment(2)
got a mac version?Muncey
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.Regulate
I
4

Open target location of chrome and navigate through cmd type

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

Incoming answered 30/1, 2018 at 9:29 Comment(0)
C
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
Calamint answered 10/7, 2014 at 20:50 Comment(3)
Says invalid agrument startGlantz
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 pauseCalamint
I did it in a batch file. No worries though. I can open up task manager and kill the process tree for chromeGlantz
D
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.

Durstin answered 2/6, 2014 at 17:2 Comment(0)
W
1

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 :-)
Worthington answered 14/2, 2023 at 3:45 Comment(0)
R
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.

Romeo answered 19/6, 2014 at 6:27 Comment(0)
P
0

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

Photoactinic answered 22/5, 2017 at 10:14 Comment(0)
J
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
Judi answered 3/9, 2019 at 7:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.