Deep in the guts of my program, I've got a standard
"http://host.network.TLD/whatever/something/foo/pagename.html"
URL to a
web page stored in an object. Where it came from, how it got into that
object, and what type of object it's in is irrelevant - Just take it as
a given that it's there, and if it needs to be "some other type of
object", converting to that type is reasonably painless.
Now that it's there, I want the user to have the option of saying "show
it to me as a web page in my preferred browser". The exact mechanism of
issuing the "show it to me" command is a detail I haven't decided on
yet, although I can see several possibilities, each with differing
levels of complexity/difficulty, and each with their own pros and cons.
Once they've done so, by whatever method, I want their chosen browser
(Safari, IE, Firefox, Lynx, *WHATEVER* browser they have configured as
their default) to fire up - assuming it isn't already running - and
load/display the page referenced by the URL as if they've manually taken
whatever steps are required to start the browser and get it to open an
arbitrary URL.
Part of the "catch" here is that I need/want to do it in a manner that's
as simple to code, and as close to "totally browser agnostic" as
possible - I don't want to be diddling around with the details of trying
to determine what the user's preferred browser is, checking to see if
it's already running or if I need to fire it up, figuring out how that
particular browser wants the URL formatted, and similar details - I just
want to say "here's a URL - open it with the user's preferred browser",
and have it "just work". On a related note, issues that may come up with
the URL after the browser gets it, such as "404/Not Found" and similar,
aren't my problem - my program isn't a web browser - That's why I'm
trying to hand the URL off to an actual browser, doncha know!
In Cocoa undr 10.3.9, is there a class/method/function I can call with
something along the general lines of
result=[useTheDefaultBrowserToOpenThisURL:objectContainingTheDesiredURL];
if (result==failed)
[re****tFailureAndContinue:@[EMAIL PROTECTED]
"URL open failed." failReason:result];
or do I need to "roll my own" to (as a best first guess) throw an
AppleEvent to the Finder, or some similar screwing around?
If such a method exists, I haven't figured out what name to look for it
under, so I've had no luck. The various NSURL methods sounded like a
good place to start looking, but I come up empty - Lots of stuff for
loading the contents of a URL *INTO MY PROGRAM* there, but zip-ola for
asking a "helper" program to load it into itself.
Right now, it looks as though I'll have to screw around with trying to
build (and properly target... which may end up being a major undertaking
in and of itself) an AppleEvent/AppleScript-like thing to pass on to
someplace else (Finder seems a likely target) to eventually get the URL
passed to whatever the user's browser is.
I'm hoping there's a simpler way. Is my hope in vain?
--
Don Bruder - dakidd@[EMAIL PROTECTED]
- If your "From:" address isn't on my
whitelist,
or the subject of the message doesn't contain the exact text
"PopperAndShadow"
somewhere, any message sent to this address will go in the garbage without
my
ever knowing it arrived. Sorry... <http://www.sonic.net/~dakidd>
for more
info


|