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%..LocalGoogleChromeApplicationchrome.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