웹 페이지에서 파일을 다운로드 할 때 파일이 너무 커서 파일이 생성되는 데 시간이 걸립니다. 현재 사용자가 웹 페이지에서 다른 작업을 수행하지 못하도록하기 위해 한 가지 방법은 DIV를 사용하여 웹 페이지를 덮어 쓰고 웹 페이지를 잠그는 것입니다.
function lockscreen () {swidth = $ (window) .width (); shight = $ (창) .height (); var bgobj = document.createElement ( "div"); bgobj.setattribute ( 'id', 'bgdiv'); bgobj.style.position = "절대"; bgobj.style.top = "0"; bgobj.style.background = "#cccccc"; bgobj.style.filter = "progid : dximagetransform.microsoft.alpha (style = 3, 불투명도 = 25, finishOpacity = 75"; bgobj.style.opacity = "0.6"; bgobj.style.left = "0"; bgobj.style.width = swidth + "; + "px"; if (swidth <860) {bgobj.style.width = "860px";위의 기능을 사용하여 페이지를 잠그고 여러 작동을 방지하고 다운로드 상자가 나타날 때까지 잠금 화면을 취소하십시오.
서버 측 (CGI)에서 쿠키를 설정합니다.
<pre name = "code"> char *configdownloadtoken = "wanidownloadfile"; printf ( "content-type : application/octet-stream/ncontent-length : %ld/n", s.st_size); printf ( "set-cookie : configdownloadtoken =%s; path =/;/r/n", configdownloadToken); printf ( "content-disposition : 첨부 파일; filename =/"%s/"/n", strrchr (filename, '/') + 1); printf ( "연결 : close/n/n");
클라이언트 (html, js)에서 플러그인 jquery.cookie.js를 가져 와서 HTML 파일 에이 플러그인을 포함시키고 js 파일에 쿠키를 정기적으로 가져옵니다.
var configdownloadchecktimer; $ (document) .ready (function () {configdownloadchecktimer = wind function finishdownload () {window.clearInterVal (configdownLoadChecktimer); $ .removeCookie ( 'configdownloadToken'); //이 쿠키 값을 지우는 것}그게 다야.