↪️

晓东 - 当前 - Web

综合
  Chrome查看证书SNI域名:扩展程序->证书主题背景的备用名称。
  Encrypted Client Hello (ECH) 是 Encrypted SNI 的后继者,它加密了用于协商 TLS 握手的服务器名称指示 (SNI)。
  a链接加download属性,若href值跨域依然不会直接下载而是新开窗口。
            
exe扩展名MIME - application/vnd.microsoft.portable-executable
必须
常用
  Fetch API:
    fetch('http://example.com/x.json').then(r => {
        if (r.status === 204) {
            return null; // 204(No Content)不能调json(),优先处理。
        } else if (r.ok) { // r.ok = 2xx开头状态码
            return r.json();
        } else { return Promise.reject('fetch error!'); }
    }).then(data => console.log(data));
                    
GAE
原则
...
内容
  • GCE免费实例:
      e2-micro实例sudo apt upgrade时因CPU小导致google-cloud-cli_452.0.1-0_all.deb安装要10分钟,并不是系统卡死。
    
    GAE特殊情况:
      请求和响应大小只能32MB(Content-Length为准);413 Payload Too Large; System.getenv("GAE_RUNTIME")返回null则非GAE环境。
      请求限制用JavaScript的 Compression Stream API(gzip)+后端自己实现gzip解压 或 GCS Signed URL 突破,响应用Accept-Encoding: gzip突破。
                                        
  • GAE会移除部分不支持的HTTP头:
      分块传输:
        Connection: keep-alive
        Transfer-Encoding: chunked
    
      WebSocket:
        Connection: Upgrade
        Upgrade: websocket
                                        
可用
Chrome注册列表(设为默认就能生效一次,用于测试至退出Chrome) - chrome://settings/handlers
注册Web自定义协议 - navigator.registerProtocolHandler('web+xiaodongexampleregisterprotocolhandler','https://xiaodo.ng/main/apis/more/ga/anonymous/temp/main/js-registerprotocolhandler-example?p=%s');

测试链接(Chrome仅首次注册才能跳转成功,重开Chrome就要关联桌面软件了)
链接跳转测试成功 - https://www.zhangxinxu.com/study/202308/js-registerprotocolhandler-demo.php
得心应手.exe注册Windows的URL Protocol:不带://则原样传值带://传值则结尾加/
                
JSF
  跳转/转向:
    渲染指定视图页面:
      //  dispatchView(fc, "passed-app-index.xhtml");
      public static void dispatchView(FacesContext fc, String viewId) {
        fc.getExternalContext().setResponseStatus(200);
        //fc.getExternalContext().getRequestMap().put("msg", msg);
        var vh = fc.getApplication().getViewHandler();
        var view = vh.createView(fc, viewId); fc.setViewRoot(view);
        try { vh.getViewDeclarationLanguage(fc, viewId).buildView(fc, view);
            vh.renderView(fc, view);
        } catch (IOException ex) { System.err.println(ex); }
        fc.responseComplete();
      } // https://rogerkeays.com/jsf-error-pages-that-actually-work
                
其他
web视频剪辑 - https://github.com/alyssaxuu/motionity
                Web TTS保存为音频文件 - https://stackoverflow.com/questions/45003548/how-to-capture-generated-audio-from-window-speechsynthesis-speak-call#answer-70665493