Display PDF using plugin : PlugIn « Development « JavaScript DHTML






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.java2s.com";
}
//-->
</script>
</head>
</html>



           
       








Related examples in the same category

1. Listing Plug-In Properties
2.Synchronizing Two Plug-Ins
3. Accessing a Plug-In
4.Determining Whether the LiveVideo Plug-In Is Installed
5.JavaScript to enumerate and display all installed plug-ins
6.Displaying Plug-In Information
7.Find pluin for Midi
8.Scan through each plug-in by provided parameters
9.Displaying a List of Navigator Plug-Ins
10.Properties of the Plugin Object