
方法 A在父頁面加meta標(biāo)簽head meta http-equivConnection contentclose /head?? 這個(gè) meta 標(biāo)簽會(huì)被瀏覽器忽略——HTTP/1.1 規(guī)范不允許用 meta 控制 Connection 頭。方法 B在父頁面用 JavaScript 動(dòng)態(tài)創(chuàng)建 iframeiframe idmyFrame/iframe script // 創(chuàng)建 iframe 時(shí)設(shè)置 fetchpriority 或 connection var iframe document.getElementById(myFrame); iframe.onload function() { // iframe 加載后強(qiáng)制關(guān)閉 keep-alive但這做不到 }; // 用 fetch API 替代 iframe推薦 fetch(/your-context/test.jsp) .then(response response.text()) .then(html { // 把 HTML 注入頁面 }); /script方法 C用 XHR 替代 iframe最穩(wěn)div idphotoContainer/div script var xhr new XMLHttpRequest(); xhr.open(GET, /your-context/test.jsp, true); xhr.onload function() { if (xhr.status 200) { document.getElementById(photoContainer).innerHTML xhr.responseText; } }; xhr.send(); /scriptXHR 默認(rèn)不帶 keep-alive取決于瀏覽器實(shí)現(xiàn)——可以繞過 WebLogic 的 keep-alive bug。