ie浏览器和edge浏览器,必须用Adobe Reader PDF阅读器才可以打开pdf文件,其他现代浏览器自带pdf阅读器,无需安装。
判断ie或者edge如果安装了,就浏览pdf文件;如果没安装就给出安装软件,让他下载、
<!DOCTYPE html><html> ???<head> ???????<meta charset="UTF-8"> ???????<title></title> ???????<script src="jquery-1.10.2_d88366fd.js"></script> ???</head> ???<body> ???????????<img src="myzh_yitou03.png" ?class="aaa"/> ???</body> ???<script> ???$(function(){ ???????????function isAcrobatPluginInstall() { ???????????????//下面代码都是处理IE浏览器的情况 ????????????????if((window.ActiveXObject)||(navigator.userAgent.indexOf("Trident") > -1)) { ???????????????????for(x = 2; x < 10; x++) { ???????????????????????try { ???????????????????????????oAcro = eval("new ActiveXObject(‘PDF.PdfCtrl." + x + "‘);"); ???????????????????????????if(oAcro) { ???????????????????????????????return true; ???????????????????????????} ???????????????????????} catch(e) {} ???????????????????} ???????????????????try { ???????????????????????oAcro4 = new ActiveXObject(‘PDF.PdfCtrl.1‘); ???????????????????????if(oAcro4) ???????????????????????????return true; ???????????????????} catch(e) {} ???????????????????try { ???????????????????????oAcro7 = new ActiveXObject(‘AcroPDF.PDF.1‘); ???????????????????????if(oAcro7) ???????????????????????????return true; ???????????????????} catch(e) {} ???????????????}else{ ???????????????//chrome和FF、safrai等其他浏览器 ???????????????????return true; ???????????????} ???????????}; ???????????????????????$(‘.aaa‘).bind(‘click‘,function(){ ???????????????var pdfresult=isAcrobatPluginInstall(); ???????????????if(pdfresult){// ???????????????????已安装后跳转 ???????????????????location = ‘跳转到aaa.html‘; ???????????????}else{// ???????????????????未安装跳转到下载安装地址 ???????????????????alert("对不起,您还没有安装PDF阅读器软件呢,为了方便预览PDF文档,请选择安装!"); ???????????????????location = ‘http://ardownload.adobe.com/pub/adobe/reader/win/9.x/9.3/chs/AdbeRdr930_zh_CN.exe‘; ???????????????} ???????????}); ???????}) ???</script></html>
js判断ie和edge是否安装Adobe Reader PDF阅读器
原文地址:http://www.cnblogs.com/gaidalou/p/7428426.html