Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

satyam90

macrumors regular
Original poster
Jul 30, 2007
242
0
Bangalore, India
Hi,

In my application I am providing a html file.
I am having a button in my dialog. On clicking that buton, i want to show the html file in Safari (or any other browser that is available). How to do this.

Regards,
Satyam.
 

hhas

macrumors regular
Oct 15, 2007
126
0
If it's a help file, don't forget that OS X provides a standard framework for dealing with those. Otherwise, you could use something like the following, which will open a resource file using the default application for that file type:

Code:
NSString *path = [[NSBundle mainBundle] pathForResource: @"yourfile" ofType: @"html"];
BOOL success = [[NSWorkspace sharedWorkspace] openFile: path];
 

garethlewis2

macrumors 6502
Dec 6, 2006
277
1
You could use an Applescript to open Safari and then display the file in question.

Other options include using fork and exec.

Using 'system'

Using NSTask.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.