Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Send URL to browser from Cocoa app

Send URL to browser from Cocoa app
Thread Tools
jonasw
Guest
Status:
Reply With Quote
Dec 30, 2000, 08:23 PM
 
I'm looking for a way to send a http/https URL to a browser from inside a Cocoa app. What I need is something similar to ICLaunchURL() in Carbon which picks a browser from the user's Internet preferences.

I've tried saving the URL to a somename.url file and then opening it using the default app for the .url extension but it fails since [[NSWorkspace sharedWorkspace] openFile:...] doesn't seem to interact well with non-Cocoa applications (Internet Explorer in my case). The NSURL* foundation classes won't help either from what I can tell. Am I supposed to use the Internet Config API from Cocoa as well?

Thanks in advance!
     
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Dec 31, 2000, 12:42 PM
 
I would suggest poring through the source to Fire.app over at http://www.epicware.com. I haven't looked through it myself, so I don't know how he handles it, but the help menu in Fire has an item that contacts his page.
     
jonasw
Guest
Status:
Reply With Quote
Jan 2, 2001, 05:04 AM
 
Excellent! Using ICLaunchURL() from Cocoa was the solution. However, I'm puzzled about mixing Cocoa and Carbon APIs in the same application -- this time it worked, but I'd be surprised if it's generally supported. I mean, I don't expect TextEdit fields to work in NSViews, or the Carbon Drag Manager DragRefs be used interchangeably with NSDragging etc. Unfortunately, Apple's documentation is lacking in this regard.


[This message has been edited by jonasw (edited 01-02-2001).]
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jan 2, 2001, 01:49 PM
 
Perhaps Apple implemented it under Cocoa for lack of a better name or something... Carbon API calls don't work from Cocoa.


Apple's Cocoa documentation is generally lacking, there's a lot of it that hasn't been written yet. I hope they fix that soon.
     
Dedicated MacNNer
Join Date: Oct 1999
Status: Offline
Reply With Quote
Jan 4, 2001, 07:42 AM
 
You can indeed use Carbon functions in Cocoa apps, just link to Carbon, initialize toolbox, convert data structures, call functions. It's just another lib, mix and match with glee!

Carbon is also a dyld lib so in theory it won't use more memory than otherwise, only loading those modules your app calls.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jan 4, 2001, 12:54 PM
 
Really? That's pretty cool :-)
Oh well, my bad.
*** Angus D slinks away into a corner.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:23 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2