help opening local html file with default browser

This question is asked here about every 3 months. Unfortunately, it’s not a topic of interest to me, so I haven’t saved the answer. I will this time, if it is posted. I used the search function for the bbs, but saw no obvious post containing the answer. Sorry.
Is it possible to ask Internet Preferences what the default browser is? If so, then the normal open command can handle this, because it has an option for opening a file with a specific program. If the default browser can be determined (somehow), changing the creator code of the file will work as well.
Be patient. Someone here has the answer.

Okay, I posted too soon. This question has been asked and answered in a variety of ways on the Applescript-Users mailing list. Go to its web page, then scroll down to the archives area, then do your search. I found 1 answer in issue
applescript-users digest, Vol 2 #638 - 15 msgs
It was:

Message: 7 Date: Mon, 30 Apr 2001 22:35:57 +1200 Subject: Re: Finding default browser with AS From: Andy Wylie To: Jan Pieter Kunst CC:
you could ask File Exchange for the browser sig Jan:

tell application "File Exchange"
set browser to creator type of (extension mapping "html")
quit end tell browser


but there may be other, better answers in the archives.

give this a whirl…

open location "file:///Macintosh%20HD/Desktop%20Folder/YourFile.html"

i think it will do what you need it to… good luck. jc

Here’s the same thing with some built-in encoding and stuff.

property urlToOpen : "" 
set encodedURL to ""
if urlToOpen is "" then set urlToOpen to (choose file) as text
repeat with thisCharacter in urlToOpen 
if contents of thisCharacter is " " then 
set encodedURL to encodedURL & "%20" 
if contents of thisCharacter is ":" then 
set encodedURL to encodedURL & "/" 
if contents of thisCharacter is not " " and contents of thisCharacter is not ":" then 
set encodedURL to encodedURL & contents of thisCharacter 
end if 
end if 
end if 
end repeat
set openThis to ("file:///" & encodedURL) as string
open location openThis

Rob J

Disregard, my last message. It won’t work.

Finally found a solution to this one. The application “Apple Browser Launcher” seems to open html files with the default browser and it’s scriptable. It was hiding in my Internet folder. Here’s the script I used to test it out.

set html_file to (choose file of type "TEXT") 
tell application "Finder" 
 set ABL_name to (name of application file id "udog") 
end tell 
tell application "Apple Browser Launcher" 
 tell application ABL_name 
  open html_file 
 end tell 
end tell 

I’m running OS 8.6. Don’t know what other OS’s shipped with this application.

Sorry about all the other stuff. You might want to just launch it, because, it has an opening dialog. After its done its work it just quits.

set html_file to (choose file of type "TEXT")
tell application "Apple Browser Launcher"
open html_file
end tell