48

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?

0

12 Answers 12

49

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

4
  • That did it. I just forgot to kill one chrome process.
    – Fields
    Sep 23, 2013 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, 2018 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 Aug 30, 2022 at 17:49
  • 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". Feb 19 at 22:16
44

The new tag for recent Chrome and Chromium browsers is :

--disable-web-security --user-data-dir=c:\my\data
4
  • 4
    This is working, using only --disable-web-security doesn't.
    – Mr Br
    May 5, 2016 at 8:20
  • let's say I want to enable web security again. How can I do it?
    – a.barbieri
    Sep 21, 2017 at 16:11
  • 3
    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 8, 2020 at 9: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 9, 2023 at 2:25
28

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!

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 luck Oct 24, 2019 at 21:07
  • Which MAC OS you have ? Oct 25, 2019 at 5:41
  • im on catolina, any luck? Jun 19, 2020 at 19:16
  • 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.
    – Kay V
    Jun 30, 2021 at 0:00
  • How to do in Linux? Feb 28, 2022 at 18:23
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).

0
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
2
  • got a mac version? Jun 19, 2020 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 8, 2020 at 9:20
4

Open target location of chrome and navigate through cmd type

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

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
3
  • Says invalid agrument start
    – Mukus
    Jul 12, 2015 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, 2015 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, 2015 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.

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

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

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
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.