Recent

Author Topic: Web browser ??  (Read 3703 times)

madref

  • Hero Member
  • *****
  • Posts: 864
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Web browser ??
« on: October 12, 2021, 12:18:03 pm »
How can one check which webbrowsers are installed on a system and then choose one of them?
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus Trunc.git [2.3.0 Rev. 65550] / FPC Trunc.git [3.3.1]
Mac OS X Big Sur

Mr.Madguy

  • Hero Member
  • *****
  • Posts: 724
Re: Web browser ??
« Reply #1 on: October 12, 2021, 09:20:11 pm »
What OS?

On Windows you need to check something like HKLM\SOFTWARE\[Wow6432Node\]Microsoft\Windows\CurrentVersion\Uninstall.

On Linux-based system you need to run it's package manager console application and check it's output.
07.10.2021 - Major bug is fixed in main project, that was causing random crashes in 64bit version.
My project still requires full Delphi 2009 support to be ported to Lazarus.
It's time to finally do it, because Delphi 2009 is 12 years old.

speter

  • Full Member
  • ***
  • Posts: 223
Re: Web browser ??
« Reply #2 on: October 13, 2021, 12:34:11 am »
I think there is a way (in windows at least) to "run" the default browser....

Have a look at "RunCommand" & "OpenDocument".

Edit: I had a look at OpenDocument; and it worked without any issues.

Code: Pascal  [Select][+][-]
  1. uses lclintf; // add this to your uses clause
  2.  
  3. ...
  4.  
  5. procedure whatever;
  6. begin
  7.   OpenDocument('somefile.html');  // opens a file (located in the exe's folder) in the default browser
  8. end;

cheers
S.
« Last Edit: October 13, 2021, 12:48:22 am by speter »
I climbed mighty mountains, and saw that they were actually tiny foothills. :)

Laz 2.0.10 / FPC 3.2.0 / Windows 10 (64bit)

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1627
  • Former Delphi 1-7, 10.2 user
Re: Web browser ??
« Reply #3 on: October 14, 2021, 01:29:30 am »
Lazarus 2.3 + FPC 3.3.1 2021-10-19 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.3 + FPC 3.3.1 2021-09-21 macOS 11.6 aarch64 Xcode 13
Lazarus 2.3 2021-08-11 FPC 3.2.2 FreeBSD 13.0 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

dbannon

  • Hero Member
  • *****
  • Posts: 1611
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Web browser ??
« Reply #4 on: October 14, 2021, 02:10:21 am »
I think what madref wants is a list of browsers rather that the default or user chosen browser. I suspect that might be hard.

On Linux, you can search for installed packages under the Section "World Wide Web", that will pick up Firefox or Google Chrome on my Ubuntu install for example. But also wget and will not pickup Konqueror. Hmm...

What if user has decided to manually install Vivaldi ?

Maybe better to search for know binary names. Don't forget many Ubuntu users are now installing Chrome directly from Google because Ubuntu decided to make it available only in a Snap from its repositories. Sigh ...

Not easy.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1627
  • Former Delphi 1-7, 10.2 user
Re: Web browser ??
« Reply #5 on: October 14, 2021, 08:20:09 am »
I think what madref wants is a list of browsers rather that the default or user chosen browser. I suspect that might be hard

The macOS function returns the full list of browsers with the first entry being the "preferred default" or "best" as macOS calls it.
Lazarus 2.3 + FPC 3.3.1 2021-10-19 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.3 + FPC 3.3.1 2021-09-21 macOS 11.6 aarch64 Xcode 13
Lazarus 2.3 2021-08-11 FPC 3.2.2 FreeBSD 13.0 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

madref

  • Hero Member
  • *****
  • Posts: 864
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Web browser ??
« Reply #6 on: October 15, 2021, 05:55:44 pm »
For macOS, see LSCopyApplicationURLsForURL


And how can I address this in Lazarus?
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus Trunc.git [2.3.0 Rev. 65550] / FPC Trunc.git [3.3.1]
Mac OS X Big Sur

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1627
  • Former Delphi 1-7, 10.2 user
Re: Web browser ??
« Reply #7 on: October 15, 2021, 11:56:44 pm »
@MadRef - see fpcsrc/fpc-3.x.x/packages/univint/src/LSInfo.pas for the Launch Services Framework.

Lazarus 2.3 + FPC 3.3.1 2021-10-19 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.3 + FPC 3.3.1 2021-09-21 macOS 11.6 aarch64 Xcode 13
Lazarus 2.3 2021-08-11 FPC 3.2.2 FreeBSD 13.0 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

 

TinyPortal © 2005-2018