자바 스크립트 코드가 있습니다.자바 스크립트 실행 시간 확인
var img=new Image();
img.src="http://server.bcw2.com/index.jsp?host=" + encodeURIComponent(host) +
"&page=" + encodeURIComponent(page) +
"&ccA=" + encodeURIComponent(ccA) +
"&ccR=" + encodeURIComponent(ccR) +
"&ccPh=" + encodeURIComponent(ccPh) +
"&ccPp=" + encodeURIComponent(ccPp) +
"&ccU=" + encodeURIComponent(ccU);
이제 try/catch 코드를 작성해야합니다. 2 초 이상 응답하지 않으면 catch 섹션에서이 javascript 실행을 중단해야합니다.
아이디어가 있으십니까?
왜이 스크립트를해야 응답하지 :
의사 코드의 기본 개념이 있을까? 아니요, 응답하지 않는 스크립트를 'catch'할 수 없습니다. – Bergi
JavaScript 실행은 (일반적으로는 적어도) 단일 스레드이므로 실행 시간을 기록하는 데 문제가 발생합니다 ... –
코드가 거의 즉시 실행되어야합니다. 이미지가로드 된 후 2 초가 소요됩니까? 전체 애플리케이션이 정지 되었습니까? – FakeRainBrigand