Recent

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

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... 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 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

Mr.Madguy

  • Hero Member
  • *****
  • Posts: 844
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.
Is it healthy for project not to have regular stable releases?
Just for fun: Code::Blocks, GCC 13 and DOS - is it possible?

speter

  • Sr. Member
  • ****
  • Posts: 349
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. :)

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Web browser ??
« Reply #3 on: October 14, 2021, 01:29:30 am »

dbannon

  • Hero Member
  • *****
  • Posts: 2791
    • 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 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • 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.

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... 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 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • 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.


 

TinyPortal © 2005-2018