Consulting

Results 1 to 6 of 6

Thread: Solved: FireFox: Redux

  1. #1
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location

    Solved: FireFox: Redux

    Killian replied in my post "Firefox Questions"

    The Gecko (the FireFox/Netscape engine) API is, AFAIK, only compatible with C++, but there are a couple of ActiveX Control Libraries for FireFox.
    You'll need to download one, run the installer for the library and register the control (regsvr32 "C:\Program Files\Mozilla ActiveX Control v1.6\mozctlx.dll") then you should be able to use all the same methods and properties as with the IE object
    I have set up Firefox 1.5 on a separate PC, downloaded the installer, registered the control, set the reference to the Mozilla Lib and tried the simplest test

    Option Explicit
    Sub mozilla()
    Dim oBr
    oBr = CreateObject("Mozilla.Browser.1")
    oBr.Visible = True
    oBr.Navigate ("http:\\www.microsoft.com")
    End Sub
    which errors with 'browser is not in a valid state'. I can check oBR.readystate which always returns 0. The Gecko DOM model refers to a window class, and I am wondering if I am missing a window or other object with the simple test.

    TIA

    Stan

  2. #2
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    Never mind... dumb post... Mozilla needs a container. Got it fixed.

  3. #3
    Knowledge Base Approver
    The King of Overkill!
    VBAX Master
    Joined
    Jul 2004
    Location
    Rochester, NY
    Posts
    1,727
    Location
    Care to explain? Howd you get that simplest test code above to work?

  4. #4
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    Sorry... I created a userform, added the MozillaBrowser control.

    Option Explicit
    Sub Moz()
    UserForm1.Show
    UserForm1.MozillaBrowser1.Navigate "www.microsoft.com", 0, "", "", ""
    End Sub
    worked pretty fast. Stan

  5. #5
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    P.S. The unfortunate ending to the story is that the ActiveX control does not address the DOM hierachy. Assuming you set a var oBR = UserForm1.MozillaBrowser1. After navigating you could address oBR.Document, but something like oBR.Document.GetElementsByTagName("table") [the Gecko DOM doesn't require oBR.Document.Body...] will come up with a wierd error like "Library is Not Registered".

    Answers my questions. The ActiveX control is not ready for Prime Time.

    Stan

  6. #6
    Quote Originally Posted by stanl
    Sorry... I created a userform, added the MozillaBrowser control.

    Option Explicit
    Sub Moz()
    UserForm1.Show
    UserForm1.MozillaBrowser1.Navigate "WEBSITE", 0, "", "", ""
    End Sub
    worked pretty fast. Stan
    hey sorry I am 2 years late but I barly saw this post. My question is how do you get this to work in beginner words? I am very new to VB.

Posting Permissions

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