Open web in Mac default brawser

Mac OSX specific forum
mag
Enthusiast
Enthusiast
Posts: 104
Joined: Mon Mar 29, 2004 1:46 pm

Open web in Mac default brawser

Post by mag »

Hi,
In Mac, How do I code to open a website in user default web browser?

Thanks
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Re: Open web in Mac default brawser

Post by michel51 »

mag wrote:Hi,
In Mac, How do I code to open a website in user default web browser?

Thanks
Hope this works.

Code: Select all

RunProgram("open", "http://www.purebasic.com","")
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2137
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Open web in Mac default brawser

Post by Andre »

Yes, this works... :-)

I use this procedure in our Multi-OS (Windows + MacOS) project:

Code: Select all

Procedure InternetLink(Link$)
  CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
    RunProgram("open", Link$, "")    
  CompilerElse
    RunProgram(Link$)      ; should open the given Link in a new browser window or register
  CompilerEndIf
EndProcedure
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Post Reply