简体   繁体   中英

Spawn chrome with --disable-web-security flag in node js

So as the question above implies I'm trying to create a chrome instance with the --disable-web-security flag, but when I run this all it does is open a new tab

const { execFile } = require('child_process');
const child = execFile('C:/Program Files (x86)/Google/Chrome/Application/chrome.exe', ['--disable-web-security', 'https://google.com']);

因此,要回答我自己的问题,您需要使用--user-data-dir运行--disable-web-security

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM