How can I associate URL files with a specific browser in Snow Leopard?

As far as I know, there is no way to associate .webloc files with a specific application. Your best bet would probably be to use some AppleScript.
I made a little script that lets you generate tiny little AppleScript applications that open in the browser that you select upon creation (OmniWeb, Safari, or Chrome).

You can download the script here, or compile it yourself from the code below.

set theURL to text returned of (display dialog "What URL would you like to bookmark?" with title "Enter URL" default answer "http://")
set theApp to (choose from list {"OmniWeb", "Safari", "Chrome"} with prompt "Which application would you like to associate with the bookmark?" with title "Select Application") as string
set theName to text returned of (display dialog "What would you like to name the bookmark?" with title "Enter Name" default answer "")
set theFolder to choose folder with prompt "Where would you like to save the bookmark?"

if theApp is "OmniWeb" then
    set theScript to "tell application \"OmniWeb\"
    activate
    try
        set theTab to make new tab at end of front browser with properties {address:\"" & theURL & "\"}
        set active tab of front browser to theTab
    on error
        make new browser with properties {address:\"" & theURL & "\"}
    end try
end tell"
else if theApp is "Safari" then
    set theScript to "tell application \"Safari\"
    activate
    try
        set theTab to make new tab at end of tabs of front window
        set the URL of theTab to \"" & theURL & "\"
    on error
        make new document
        set theTab to tab 1 of front window
        set the URL of theTab to \"" & theURL & "\"
    end try
    set current tab of front window to theTab
end tell"
else if theApp is "Chrome" then
    set theScript to "tell application \"Google Chrome\"
    activate
    if (count of windows) = 0 then
        make new window
        set URL of tab 0 of front window to \"" & theURL & "\"
    else
        set URL of (make new tab at end of tabs of front window) to \"" & theURL & "\"
    end if
end tell"
end if

tell application "AppleScript Editor"
    set theDoc to make new document with data theScript
    save theDoc as "application" in ((theFolder as string) & theName & ".app")
end tell

Running that will prompt you for the URL, the browser you want it to open with, and the location to save the 'bookmark'.

You can put this in your Applications or Scripts folder for easy access and invoke it whenever you want to save a URL.


You need to make an Automator Script with these elements: (and save as an App)

  • RunShellScript -> open -a Firefox.app
  • Pause (2 Seconds)
  • RunShellScript -> open -a Firefox.app http://www.apple.com