PDA

View Full Version : Solved: FireFox: Redux



stanl
01-19-2006, 12:36 PM
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 (http://www.iol.ie/%7Elocka/mozilla/MozillaControl16.exe), 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

stanl
01-19-2006, 02:40 PM
Never mind... dumb post... Mozilla needs a container.:banghead: Got it fixed.

mvidas
01-20-2006, 06:53 AM
Care to explain? :) Howd you get that simplest test code above to work?

stanl
01-20-2006, 10:28 AM
Sorry... I created a userform, added the MozillaBrowser control.



Option Explicit
Sub Moz()
UserForm1.Show
UserForm1.MozillaBrowser1.Navigate "www.microsoft.com (http://www.microsoft.com)", 0, "", "", ""
End Sub


worked pretty fast. Stan

stanl
01-20-2006, 01:58 PM
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

OrangeStar
05-23-2008, 05:31 PM
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.