23

I am trying to access some local files via jqueryMobile, it works fine in Firefox and IE but Chrome gives a security exception. I can open Chrome in disabled security mode to access local files by using

C:\Program Files\Chrome\Chrome.exe --disable-web-security

or run it via this

chrome.exe --disable-web-security

but is there any way I can create a shortcut on desktop that will always open Chrome in disabled security mode?

AJPerez
  • 3,435
  • 10
  • 61
  • 91
AddyProg
  • 2,960
  • 13
  • 59
  • 110
  • 1
    Take a look at [Adding Command-Line Switches To Windows Shortcuts](http://superuser.com/questions/358565/adding-command-line-switches-to-windows-shortcuts) on superuser. – allonhadaya Jun 18 '14 at 16:09

13 Answers13

34

Just clone the shortcut for chrome you have on your desktop, and then in the shortcut properties add the parameter --disable-web-security (and --user-data-dir) at the end of chrome executable path

e.g

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

Edit #1 : I changed google chrome path, the old one was not correct. I just tried it on XP with fresh Chrome installed, but i got a error message that this flag is not supported.

Edit #2 : http://peter.sh/experiments/chromium-command-line-switches/

Rabin
  • 826
  • 10
  • 21
18

First search Run, then try this:

chrome.exe --user-data-dir="C:/Chrome dev session" --disable-web-security 
arghtype
  • 4,376
  • 11
  • 45
  • 60
user7527943
  • 181
  • 1
  • 2
5

just a quick update, now you need not only --disable-web-security but --user-data-dir to sum it up: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir

John
  • 197
  • 2
  • 4
  • 2
    DO NOT run this without a path assigned to `user-data-dir`. The reason this argument is required is to prevent users from disabling web security in the default profile that (presumably) is signed into Facebook / Google / your bank / etc etc. You should always explicitly specify the path for a dev-only profile. – James B Nov 06 '19 at 11:34
3

You must use the following flags

--disable-web-security 
--user-data-dir

but also pass the path to your chrome user profile

See this:

https://productforums.google.com/forum/#!topic/chrome/9nHBcjNW384 https://bugs.chromium.org/p/chromium/issues/detail?id=575690

So now i have top pass my user profile path:

C:\Users\user\projects\project>"C:\Program Files (x86)\Google\Chrome\App
lication\chrome.exe" --disable-web-security --user-data-dir="C:\Users\user\A
ppData\Local\Google\Chrome\User Data\Default"
Spiff
  • 3,873
  • 4
  • 25
  • 50
  • I don't pass my user profile path and it works just fine. maybe there's an internal default setting? – John Nov 01 '16 at 01:58
  • This is the only way that worked for me. In my case, it didn't work until I specified the user data dir – Agorreca Feb 14 '18 at 13:24
3

For MAC (ios)

Run following command in terminal.

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

Parth Patel
  • 167
  • 3
  • 19
2

It's working You have to add that parameter --disable-web-security in Target location after one space

2

Goto window search type Run

then on the run popup

just paste "chrome.exe --user-data-dir="C:/Chrome dev session" --disable-web-security "

and ok || worked for me :)

abhinavsinghvirsen
  • 1,853
  • 16
  • 25
1

For Windows10:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir="C:\temp"
Clomp
  • 3,168
  • 2
  • 23
  • 36
  • This is the old method. You have to also use `--user-data-dir="..."` after the above commands. – Clomp Mar 10 '20 at 21:58
1

Now it's

--disable-web-security --user-data-dir="c:/someFolderName"

Kornilov Ruslan
  • 133
  • 1
  • 3
1

chrome security command for windows open run->than paste this command and make sure you have to close all windows before run this command

"chrome --disable-web-security --user-data-dir"

0

For Ubuntu,

google-chrome --args --disable-web-security --user-data-dir="Path_To_Project_Directory"
sid7747
  • 690
  • 7
  • 15
0

Creating Google Chrome Ubuntu Windows10 chrome.exe --disable-web-security --user-data-dir=c:\my-chrome-data\data

-1

Why don't you try with Safari browser? It is simple to disable web security over there.

Simply click on

Develop > Disable Cross-Origin Restrictions

in the menu bar.

In order to get Develop menu, do the following:

Preferences > Advanced > Show Develop menu in menu bar.