1 |
2 |
samiam9512 |
|
2 |
|
|
function checkJre(){
|
3 |
|
|
|
4 |
|
|
var agt=navigator.userAgent.toLowerCase();
|
5 |
|
|
var is_major = parseInt(navigator.appVersion);
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')== -1)
|
9 |
|
|
&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')== -1)
|
10 |
|
|
&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')== -1));
|
11 |
|
|
var is_nav4up = (is_nav && (is_major >= 4));
|
12 |
|
|
|
13 |
|
|
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
|
14 |
|
|
var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!= -1) );
|
15 |
|
|
var is_ie5_5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") != -1));
|
16 |
|
|
var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.0") != -1));
|
17 |
|
|
|
18 |
|
|
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) ) );
|
19 |
|
|
|
20 |
|
|
var pluginDetected = false;
|
21 |
|
|
var activeXDisabled = false;
|
22 |
|
|
|
23 |
|
|
// we can check for plugin existence only when browser is 'is_ie5up' or 'is_nav4up'
|
24 |
|
|
if(is_nav4up) {
|
25 |
|
|
|
26 |
|
|
// Refresh 'navigator.mimeTypes' to get newly installed mimeTypes.
|
27 |
|
|
// Use 'navigator.mimeTypes.refresh(false)' to refresh mimeTypes
|
28 |
|
|
// without refreshing open documents (browser windows)
|
29 |
|
|
|
30 |
|
|
// check for Java plugin in installed mimeTypes
|
31 |
|
|
if(navigator.mimeTypes ) {
|
32 |
|
|
//window.alert( "length");
|
33 |
|
|
//window.alert( navigator.mimeTypes.length);
|
34 |
|
|
for (i=0; i < navigator.mimeTypes.length; i++) {
|
35 |
|
|
//window.alert(navigator.mimeTypes[i].type);
|
36 |
|
|
if( (navigator.mimeTypes[ i].type != null)
|
37 |
|
|
&&(navigator.mimeTypes[ i].type.indexOf(
|
38 |
|
|
"application/x-java-applet;jpi-version=1.4") != -1) ) {
|
39 |
|
|
|
40 |
|
|
pluginDetected = true;
|
41 |
|
|
break;
|
42 |
|
|
}
|
43 |
|
|
|
44 |
|
|
}
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
} else if (is_ie5up) {
|
48 |
|
|
var javaVersion;
|
49 |
|
|
var shell;
|
50 |
|
|
try {
|
51 |
|
|
// Create WSH(WindowsScriptHost) shell, available on Windows only
|
52 |
|
|
shell = new ActiveXObject("WScript.Shell");
|
53 |
|
|
|
54 |
|
|
if (shell != null) {
|
55 |
|
|
// Read JRE version from Window Registry
|
56 |
|
|
try {
|
57 |
|
|
javaVersion = shell.regRead
|
58 |
|
|
("HKEY_LOCAL_MACHINE\\Software\\JavaSoft\\Java Runtime Environment\\CurrentVersion");
|
59 |
|
|
} catch(e) {
|
60 |
|
|
// handle exceptions raised by 'shell.regRead(...)' here
|
61 |
|
|
// so that the outer try-catch block would receive only
|
62 |
|
|
// exceptions raised by 'shell = new ActiveXObject(...)'
|
63 |
|
|
}
|
64 |
|
|
}
|
65 |
|
|
} catch(e) {
|
66 |
|
|
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' ");
|
67 |
|
|
|
68 |
|
|
activeXDisabled = true;
|
69 |
|
|
}
|
70 |
|
|
|
71 |
|
|
// Check whether we got required (1.4+) Java Plugin
|
72 |
|
|
if ( (javaVersion != null) && (javaVersion.indexOf("1.4") != -1) ) {
|
73 |
|
|
pluginDetected = true;
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
if (pluginDetected) {
|
80 |
|
|
|
81 |
|
|
// show applet page
|
82 |
|
|
document.location.href="newappletref.htm";
|
83 |
|
|
|
84 |
|
|
} else if (confirm("Java Plugin 1.4+ not found, Do you want to download it?\n" +
|
85 |
|
|
"if you choose not to install the plugin the reports graphical applets will not be available.")) {
|
86 |
|
|
|
87 |
|
|
// show install page
|
88 |
|
|
document.location.href=XilinxD;
|
89 |
|
|
|
90 |
|
|
} else {
|
91 |
|
|
// show error page
|
92 |
|
|
document.location.href="newappletref.htm";
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
}
|
96 |
|
|
|