Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to check browser version (not only what browser)

1 view
Skip to first unread message

Lars-Erik Østerud

unread,
Mar 19, 2007, 11:14:16 AM3/19/07
to
I need to check what browser the user has as default
(like Internet Explorer, Firefox or Opera).

And I need to check for IE if it is IE6 or IE7
(for some reason they behave differently when launching
HTML-files with anchors, see more info further down).

Is that possible in an easy way from Delphi?


Here are the strange results I have tested my way into:

I need to launch the default browser with a HTML document and a
reference to an anchor (A NAME reference) inisde that document:

"file:///D:/docs.html#chapter1" does NOT work with either one

For Internet Explorer 6:

"iexplore.exe" "file:///D:/docs.html#chapter1" works OK
"explorer.exe" "file:///D:/docs.html#chapter1" does NOT work

For Internet Explorer 7:

"iexplore.exe" "file:///D:/docs.html#chapter1" does NOT work
"explorer.exe" "file:///D:/docs.html#chapter1" work OK

For Firefox 2.0

"firefox.exe" "file:///D:/docs.html#chapter1" works OK
"explorer.exe" "file:///D:/docs.html#chapter1" does NOT work

Why the difference? All launch the HTML document, but in the cases
marked "does NOT work" the reference ("#chapter1") is lost :-(

Is there a safe way to do this that will always work right?

Very strange that IE6 and IE7 does not work equal in any case !!!

I can assume that the user has IE6 or IE7 on the PC, but when they
need different command-line to work, then I can't predict that...

Is there a common way that will work for both IE6 and IE7, or a way to
check what is the default browser on the system (then my program can
choose the right command line if I knows if it is IE6, IE7 or Firefox)
--
Lars-Erik - http://www.osterud.name - ICQ 7297605

Abigoven

unread,
Jun 18, 2007, 8:07:46 AM6/18/07
to
why not at this way...

You need a label on a form.

uses ShellAPI;

procedure TForm1.FormCreate(Sender: TObject);
begin
Self.Label1.Caption := 'http://www.somenet.com'; { put in correct URL here }
end;

procedure TForm1.Label1Click(Sender: TObject);
begin
ShellExecute(Application.Handle, 'open', PChar(Label1.Caption), nil, nil, SW_SHOWNORMAL);
end;

0 new messages