Mega Code Archive

 
Categories / JavaScript DHTML / Development
 

Display PDF using plugin

<html> <head> <script language="JavaScript"> <!-- function findPlugin(ext) {   var thisExt, findExt;   for (var n=0; n < navigator.plugins.length; n++) {       for (var m=0; m < navigator.plugins[n].length; m++) {           thisExt = navigator.plugins[n][m].description.toLowerCase();           findExt = thisExt.substring(0, thisExt.indexOf(" "));           if (findExt == ext)              return(true);       }   }   return(false); }    if (findPlugin("pdf")) {    document.open();    document.write("<embed src='yourFile.pdf' width='100%'>");    document.close(); } else {    location = "http//www.rntsoft.com"; } //--> </script> </head> </html>