question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with disable web security in Chromium and Chrome in Mac

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Reactions:22
  • Comments:12

github_iconTop GitHub Comments

2reactions
xgqfrmscommented, Jun 25, 2022

--disable-web-security flag

1reaction
LeeSwaggercommented, Sep 22, 2020

Hi, this works for me:

const browser = await puppeteer.launch({
  args: [
     '--disable-features=SameSiteByDefaultCookies,CookiesWithoutSameSiteMustBeSecure'
  ]
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable-web-security in Chrome 48+ - Stack Overflow
3. Just because a value isn't required to make it work doesn't mean it's a good idea. · 1. On my Mac with...
Read more >
575690 - `--disable-web-security` works with an empty value ...
Issue 575690: `--disable-web-security` works with an empty value for `--user-data-dir` · 1. Start Chrome Canary with the --disable-web-security ...
Read more >
Run Chrome browser without CORS - Aleksandr Filatov
Just do follow steps: Right click on desktop, add new shortcut; Add the target as "[PATH_TO_CHROME]\chrome.exe" --disable-web-security ...
Read more >
Run Chrome browser without CORS by disabling web security
We can run the chrome browser in a security disabled mode, this is very helpful while developing a application. OSX. open -n -a...
Read more >
100% Working Code]- Disable same origin policy in Chrome ...
Disable same origin policy in Chrome - The --disable-web-security is no longer supported in recent chrome versions.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found