launchInDefaultBrowser on mac


#1

Hi all,

I want to open a local pdf doc from a menu… on windows it seems quite simple… create a path, something like:

URL url = “c:\docs\mydoc.pdf”;

and then:

url.luanchInDefualtBrowser();

ok, so I assumed something similar on macs…

URL url = “~/docs/mydoc.pdf”

but nothing happens… is there a better way to open documents than via the url class? or am I missing something obvious when using it on macs? Shouldn’t this work?


#2

Well “~/docs/mydoc.pdf” isn’t a valid URL, is it? Maybe if you used “file://Users/yourname/etc” it might have had a fighting chance!

But you probably want to use File::startAsProcess() instead.


#3

That’s what I was looking for :wink: thx