zoukankan      html  css  js  c++  java
  • 用临时用户数据目录启动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%..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
  • 相关阅读:
    03点云文件常用格式转换(pcd,txt,ply,obj,stl)
    04点云数据结构格式
    vs2015 +ZXing/Zbar的环境配置
    01PCL 点云+vs2015在win10下的环境配置
    07点云的滤波与分割
    gitlabCI/CD部署一个java项目
    k8s 为什么需要数据卷
    gitlab Runner 安装与部署
    gitlab ci/cd介绍
    k8s emptyDir临时数据卷
  • 原文地址:https://www.cnblogs.com/Bob-wei/p/8310733.html
Copyright © 2011-2022 走看看