프로그래밍/JavaScipt

javascript ie pdf 설치 여부확인

p-a-r-k 2016. 12. 22. 16:40
반응형

크롬은 자체 pdf리더 지원

익스에서 체크할일 생김ㅋ


function fnFoundPdf(){
	var found = false;
	var info = '';

	try{    
		 acrobat4 = new ActiveXObject('PDF.PdfCtrl.1');    
		 if (acrobat4){      
			  found = true;      
			  info = 'v. 4.0';    
		 }  
	} catch (e){
		 //???
	}

	if (!found){
		 try{
			  acrobat7 = new ActiveXObject('AcroPDF.PDF.1');
			  if (acrobat7){
					 found = true;
					 info = 'v. 7+';
			  }
		 } catch (e) {
			  //???
		 }

		 if (!found && navigator.plugins && navigator.plugins.length>0){
			  for (var i = 0; i -1){
							found = true;
							info = navigator.plugins[i].description + ' (' + navigator.plugins[i].filename + ')';
							break;
					 }
			  }
		 }
	}

	return found;
}


if(isIE()){
	if(!fnFoundPdf()){
		alert("PDF리더 프로그램을 설치해주세요.")
		document.downFrame.location.href = '/파일다운.asp?filepath=down/&filename=readerdc_kr_xa_install.exe';
		return;
	}
}
반응형