用临时用户数据目录启动Chrome,关闭安全检查等(解决Cross origin requests are only supported for HTTP?)...

Cross origin requests are only supported for HTTP?

参考:https://www.zhihu.com/question/20948649

 

批处理:

start_chrome_with_tmp_userdata.bat

 1 @echo off
 2 pushd %~dp0
 3 set TMP_USERDATA="%CD%/tmp_userdata"
 4 set TMP_URL="%~1"
 5 if %TMP_URL%=="" goto :help
 6 echo Starting chrome...
 7 "%appdata%\..\Local\Google\Chrome\Application\chrome.exe" --allow-file-access-from-files --disable-web-security --user-data-dir=%TMP_USERDATA% %TMP_URL%
 8 echo Cleannig tmp dir...
 9 ping 127.1 -n 1 >nul
10 rd /s /q %TMP_USERDATA% >nul
11 goto :end
12 :help
13 set TMP_CMD=%~n0%~x0
14 echo Usage:
15 echo [1] %TMP_CMD% http://www.baidu.com
16 echo [2] call %TMP_CMD% http://www.baidu.com
17 echo.
18 echo Press any key to exit...
19 pause>nul
20 :end
21 popd

 

调用例子1:

@echo off
call start_chrome_with_tmp_userdata.bat "%CD%\video-js-6.6.2/examples/index.html"

 

调用例子2:

C:\> start_chrome_with_tmp_userdata.bat http://www.baidu.com

 


 

Python3 启动http

start_python_web.bat

 1 @echo off
 2 pushd %~dp0
 3 set port=%~1
 4 if "%port%"=="" goto :help
 5 set process_title=%~n0,%port%
 6 echo Kill last process...
 7 taskkill /f /fi "WINDOWTITLE eq %process_title%" > nul
 8 echo Starting python http.server %port%...
 9 start "%process_title%" python -m http.server %port%
10 goto :end
11 :help
12 set TMP_CMD=%~n0%~x0
13 echo Usage:
14 echo set port=8081
15 echo call %TMP_CMD% %%port%%
16 echo start "" http://localhost:%%port%%
17 echo.
18 echo Press any key to exit...
19 pause>nul
20 :end
21 popd

 

例子:

1 @echo off
2 set port=8081
3 call start_python_web.bat %port%
4 ping 127.1 -n 1 >nul
5 echo Starting demo...
6 start "" http://localhost:%port%/video-js-6.6.2/examples/simple-embed/h265.html
7 start "" http://localhost:%port%/libde265.js/demo/libde265_DEMO.html

 

转载于:https://www.cnblogs.com/Bob-wei/p/8310733.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值