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 > how can i find out a user's default browser?

how can i find out a user's default browser?
Thread Tools
Dedicated MacNNer
Join Date: May 2001
Status: Offline
Reply With Quote
Apr 14, 2002, 06:02 AM
 
Hi, sorry for a simple question, im a newb coder.
how can i find out a user's default browser? Using applescript is preferable, but plain C is ok too.

I know to open a web page with the default browser, I can use "open location" from applescript, but while using applescript to do
'open location "http://forums.macnn.com"'
is there a way to refresh that same window to open a different URL later? if I could keep changing the top window's url location, then I won't need to find the user's default browser becuase I was going to write some code to show a user a few places on the internet, kind of like a virtual tour.
I don't want to use Internet Explorer applescript commands becuase a lot of people don't even have IE on their machines, like me( chimera 0.2) =)

Thanks in advance.
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Apr 14, 2002, 12:14 PM
 
Originally posted by gee308:
<STRONG>Hi, sorry for a simple question, im a newb coder.
how can i find out a user's default browser? Using applescript is preferable, but plain C is ok too.

I know to open a web page with the default browser, I can use "open location" from applescript, but while using applescript to do
'open location "http://forums.macnn.com"'
is there a way to refresh that same window to open a different URL later? if I could keep changing the top window's url location, then I won't need to find the user's default browser becuase I was going to write some code to show a user a few places on the internet, kind of like a virtual tour.
I don't want to use Internet Explorer applescript commands becuase a lot of people don't even have IE on their machines, like me( chimera 0.2) =)

Thanks in advance.</STRONG>
Chimera is scriptable? I still need to try that out... This doesn't help directly.. but you can't get the browser from the prefs... all the data is encrypted :/ I guess that's a semi-good thing...
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Apr 14, 2002, 07:16 PM
 
To just launch a URL in the default browser without carign what window it goes in is easy. In a Cocoa app, there's -[NSWorkspace openURL:]. That's just a convenient Obj-C cover for the LaunchServices function LSOpenCFURLRef(), which you can use in any app.

To specify what window a URL gets opened in is much more difficult -- you have to talk to the web browser directly using AppleEvents/AppleScript, and different web browsers do this differently. Finding out which browser to talk to isn't too difficult, though: LaunchServices provides functions for getting the application which "owns" a particular URL scheme, so just get the app for http.
Rick Roe
icons.cx | weblog
     
   
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 09:46 AM.
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