You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
3.3 KiB

3 years ago
  1. function checkJre(){
  2. var agt=navigator.userAgent.toLowerCase();
  3. var is_major = parseInt(navigator.appVersion);
  4. var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')== -1)
  5. && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')== -1)
  6. && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')== -1));
  7. var is_nav4up = (is_nav && (is_major >= 4));
  8. var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
  9. var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!= -1) );
  10. var is_ie5_5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") != -1));
  11. var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.0") != -1));
  12. var is_ie5up = (is_ie && (is_major == 4) && ( (agt.indexOf("msie 5.0")!=-1) || (agt.indexOf("msie 5.5")!=-1) || (agt.indexOf("msie 6.0")!=-1) ) );
  13. var pluginDetected = false;
  14. var activeXDisabled = false;
  15. // we can check for plugin existence only when browser is 'is_ie5up' or 'is_nav4up'
  16. if(is_nav4up) {
  17. // Refresh 'navigator.mimeTypes' to get newly installed mimeTypes.
  18. // Use 'navigator.mimeTypes.refresh(false)' to refresh mimeTypes
  19. // without refreshing open documents (browser windows)
  20. // check for Java plugin in installed mimeTypes
  21. if(navigator.mimeTypes ) {
  22. //window.alert( "length");
  23. //window.alert( navigator.mimeTypes.length);
  24. for (i=0; i < navigator.mimeTypes.length; i++) {
  25. //window.alert(navigator.mimeTypes[i].type);
  26. if( (navigator.mimeTypes[ i].type != null)
  27. &&(navigator.mimeTypes[ i].type.indexOf(
  28. "application/x-java-applet;jpi-version=1.4") != -1) ) {
  29. pluginDetected = true;
  30. break;
  31. }
  32. }
  33. }
  34. } else if (is_ie5up) {
  35. var javaVersion;
  36. var shell;
  37. try {
  38. // Create WSH(WindowsScriptHost) shell, available on Windows only
  39. shell = new ActiveXObject("WScript.Shell");
  40. if (shell != null) {
  41. // Read JRE version from Window Registry
  42. try {
  43. javaVersion = shell.regRead
  44. ("HKEY_LOCAL_MACHINE\\Software\\JavaSoft\\Java Runtime Environment\\CurrentVersion");
  45. } catch(e) {
  46. // handle exceptions raised by 'shell.regRead(...)' here
  47. // so that the outer try-catch block would receive only
  48. // exceptions raised by 'shell = new ActiveXObject(...)'
  49. }
  50. }
  51. } catch(e) {
  52. window.alert(" Creating ActiveX controls thru script is disabled \n in InternetExplorer security options \n To enable it: \n a. Go to the 'Tools -->; Internet Options' menu\n b. Select the 'Security' tab\n c. Select zone (Internet/Intranet)\n d. Click the 'Custom Level..' button which will display the\n 'Security Settings' window.\n e. Enable the option 'Initialize and script ActiveX controls\n not marked as safe' ");
  53. activeXDisabled = true;
  54. }
  55. // Check whether we got required (1.4+) Java Plugin
  56. if ( (javaVersion != null) && (javaVersion.indexOf("1.4") != -1) ) {
  57. pluginDetected = true;
  58. }
  59. }
  60. if (pluginDetected) {
  61. // show applet page
  62. document.location.href="newappletref.htm";
  63. } else if (confirm("Java Plugin 1.4+ not found, Do you want to download it?\n" +
  64. "if you choose not to install the plugin the reports graphical applets will not be available.")) {
  65. // show install page
  66. document.location.href=XilinxD;
  67. } else {
  68. // show error page
  69. document.location.href="newappletref.htm";
  70. }
  71. }