Issue with disable web security in Chromium and Chrome in Mac
See original GitHub issueI am using puppeteer to open an iframe in browser which has allowed only same origin. So if i open chrome with flag --disable-web-security
, The embedding of iframe works.
But here is the problem, If i use chrome instance of my Mac with params
This works
const browser = await puppeteer.launch({
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
ignoreDefaultArgs: true,
args: [
"--disable-web-security",
"--user-data-dir",
"--enable-usermedia-screen-capturing",
"--allow-http-screen-capture",
"--start-fullscreen",
"--kiosk",
"--disable-infobars"
],
headless: false,
});
This doesn’t because it uses Chromium.
const browser = await puppeteer.launch({
ignoreDefaultArgs: true,
args: [
"--disable-web-security",
"--user-data-dir",
"--enable-usermedia-screen-capturing",
"--allow-http-screen-capture",
"--start-fullscreen",
"--kiosk",
"--disable-infobars"
],
headless: false,
});
Even If i change the first part of using chrome with different dir it doesn’t work. For eg this doens’t work either
const browser = await puppeteer.launch({
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
ignoreDefaultArgs: true,
args: [
"--disable-web-security",
"--user-data-dir=/tmp/crm",
"--enable-usermedia-screen-capturing",
"--allow-http-screen-capture",
"--start-fullscreen",
"--kiosk",
"--disable-infobars"
],
headless: false,
});
I tried running chromium that comes with puppeteer directly using command:
./Chromium --disable-web-security --user-data-dir
and opened the page manually which has iframe from different origin. I still got an error:
Refused to display 'url' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
Wondering why disable web security is not working with pupeeteer. I am using
- Puppeteer version: 1.11.0
- Platform / OS version: Mac OS Mojave
- Node.js version: 10.6.0
Issue Analytics
- State:
- Created 5 years ago
- Reactions:22
- Comments:12
Top GitHub Comments
--disable-web-security
flagHi, this works for me: