Results 1 to 4 of 4

Thread: Problem with accessing javascript in mozilla

  1. #1
    Join Date
    Dec 2007
    Posts
    13
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Problem with accessing javascript in mozilla

    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>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2007
    Posts
    13
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

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

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by jscheuer1 View Post
    I'm not sure what type of information you are getting with that script
    Quote Originally Posted by thallasridevi View Post
    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •