PDA

View Full Version : Problem with accessing javascript in mozilla



thallasridevi
12-28-2007, 03:02 PM
Hello,
I am trying to get system information. I found a script. When i tried it, it is working in internet explorer. But it is not working with mozilla.

I think problem is with below statement as activeX might not work with mozilla.

var locator = new ActiveXObject ("WbemScripting.SWbemLocator");

Please anyone tell me the alternative solution for this.

Here is the script:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET
7.1">
<meta name="vs_targetSchema" content="http://
schemas.microsoft.com/intellisense/ie5">
<script id="clientEventHandlersJS" language="javascript">
<!--

function Button1_onclick() {
var locator = new ActiveXObject ("WbemScripting.SWbemLocator");
var service = locator.ConnectServer(".");
var properties = service.ExecQuery("SELECT * FROM Win32_OnBoardDevice");
var e = new Enumerator (properties);
document.write("<table border=1>");
dispHeading();
for (;!e.atEnd();e.moveNext ())
{
var p = e.item ();
document.write("<tr>");
document.write("<td>" + p.DeviceType + "</td>");
document.write("<td>" + p.Description + "</td>");
document.write("<td>" + p.Enabled + "</td>");
document.write("<td>" + p.Tag + "</td>");
document.write("</tr>");
}
document.write("</table>");
}

function dispHeading()
{
document.write("<thead>");
document.write("<td>DeviceType</td>");
document.write("<td>Description</td>");
document.write("<td>Enabled</td>");
document.write("<td>Tag</td>");
document.write("</thead>");
}

//-->
</script>
</head>
<body>
<INPUT id="Button1" type="button" value="Button"
name="Button1" language="javascript" onclick="return Button1_onclick()">
</body>
</html>

jscheuer1
12-28-2007, 06:21 PM
Active X works only in IE. It can even be easily, and often is, disabled in that browser.

I'm not sure what type of information you are getting with that script, but lots of info can be gotten using regular javascript. Other information can often be gotten using server side code like PHP or asp.

thallasridevi
12-29-2007, 06:18 AM
can you please tell me how can i get that info using regular javascript?

jscheuer1
12-29-2007, 06:31 AM
I'm not sure what type of information you are getting with that script


can you please tell me how can i get that info using regular javascript?

What info are you getting? Some information may not be accessible with regular javascript.