Safari and “.webloc” files

Posted by Pierre Igot in: Macintosh
November 16th, 2003 • 1:38 am

I’ve already written before about the weird way in which files with the “.webloc” extension are handled in Mac OS X. I am afraid things haven’t changed much in Panther.

A “.webloc” file is typically created when you click on the proxy icon next to the URL of a web page in the Address Bar in Safari and drag that icon to the Finder. The “.webloc” file thus created is a file containing the URL of the page. You can double-click on the file to open the corresponding web page in Safari.

Yet if you look at the information of a “.webloc” file in the Finder, you’ll see that, under “Open with:”, it says “Finder” and not “Safari”. In other words, the default application for opening “.webloc” files is the Finder.

How come double-clicking on such a file opens the web page in Safari then? Because (presumably) what Mac OS X does when you open a “.webloc” file is that it looks up in its settings what your application of choice is for viewing web pages (i.e. your default browser). If it’s Safari, then the “.webloc” file will open the web page in Safari. If it’s another browser, that other browser will be used when you double-click on a “.webloc” file in the Finder.

In other words, “.webloc” files don’t work like other files in the Finder. For other files, the application that they will be opened with when you double-click on them is indicated in the Information window under “Open with:”. For “.webloc” files, the application used to open them is determined through a separate mechanism that looks up your default browser setting.

This problem is further complicated by the fact that, in their infinite wisdom, in Panther Apple have decided to remove the “Internet” preference pane from System Preferences and integrate its content into the Mail and Safari preferences dialogs. In other words, if you want to change your default web browser from Safari to Camino, you need to… launch Safari and go to its “Preferences” dialog and change the setting under “General”. As Jeff Carlson recently wrote in TidBITS, this is totally non-intuitive and a lame attempt to enforce usage of Apple’s own Safari and Mail applications.

(I highly recommend using Monkey Food Software’s More Internet freeware preference pane to put these Internet settings back where they belong, i.e. in the System Preferences application.)

Getting back to today’s topic… If you go to Safari’s “Preferences” dialog and change the default browser to Camino, and then if you go to the Finder and double-click on a “.webloc” file, the corresponding web page will now be loaded in Camino rather than Safari. Yet the “Open with:” setting for “.webloc” files still says “Finder”.

The reason I am writing about this today is not because of this particular approach, which has its own justifications, even though its inconsistent with the rest of the Mac OS X interface regarding the way the process of opening files is handled.

No. The problem today is that this “alternative” approach used for opening “.webloc” files has unfortunate consequences in terms of usability.

For one, if you take a “.webloc” file in the Finder and drag it onto the “Safari” icon in the Dock, nothing will happen. Even though Safari is indeed the application used for opening “.webloc” files (from the user’s point of view), you cannot drag and drop a “.webloc” file onto the application’s icon.

What you can do, however, is open a blank window in Safari, and then go to the Finder and drag the “.webloc” file onto that blank Safari window in the background. This will cause Safari to load the corresponding web page.

But even then, things don’t work as expected. If you select more than one “.webloc” file in the Finder and drag your selection of files onto the blank Safari window in the background, Safari only opens the first “.webloc” file in your selection. All other “.webloc” files in your selection are ignored.

The only way to select more than one “.webloc” file in the Finder and get Safari to open all these files is to double-click on your selection in the Finder. Depending on what your preferences are in Safari, this will open each “.webloc” in a separate Safari window or in a separate tab in the same Safari window.

In a nutshell, the problem here is not that things don’t work, it is that they don’t work as can be reasonably expected by the end user, who couldn’t care less about what underlying mechanism is used by Mac OS X to open “.webloc” files. The bottom-line is that the process of opening such files should be identical to the process of opening other files — and it is not.

(Also, please refer to this item for more on the mess that Mac OS X’s handling of file extensions can create.)

3 Responses to “Safari and “.webloc” files”

  1. Warner Lowe says:

    _The attachment which would not paste is from a page from:

    which states:
    “account suspended.

    Your account has been suspended. We have sent you an email explaining why. This email also contains information on how you can unsuspend your account.”

  2. Warner Lowe says:

    Subject: Strange occurrence


    Recently a private individual URL site was passed on to me that featured monthly Playboy centerfold jpg. files from 1953 through 2002. All files were small, ie about 300k and were jpg.

    I did not download these files initially.
    When I returned to the site several days later, a message was posted from the ISP as shown in the attachment:


    Now comes the interesting part:

    I again returned to the site a week later, and was able to download the jpg, files to my desktop in full color.
    G4: OS 10.3.6:

    Several nights later while walking past my sleeping computer with all applications except Finder off, but connected to the cable modem, Safari and IE off, I noticed the screen lit up and a scrolling series of near identical messages.

    I could not exercise any control over the scrolling except to turn the computer off.

    The following night the same thing happened.

    Several days later I attempted to open the jpg files and noted to my surprise that they were now all: .jpg.webloc files.

    I believe the un-commanded scrolling changed all of the downloaded .jpg files to the .jpg.webloc files at the behest of the ISP shown in the attachment.

    Now clicking on any one of the downloaded files produces the attachment.

    Deleting the .webloc on any file to revert to .jpg has no effect.

    Returning to the original URL site also produces the attachment message.

    My only conclusion is that a cookie trail was established when initially downloading, that was then employed by the ISP to change all of the files so that they were not useable.

    I understand that there are copyright aspects to this although I don’t know whether or not 50 year old photos are protected.

    I would appreciate your thoughts on this matter, especially the thought of an outside agency being able to invade my computer and alter file formats. I realize that if I had burned the files to a CD I wouldn’t be writing you.


  3. OrbitalDescent says:

    While we’re on the subject of webloc files, I thought I would share an app that I had just developed, called Weblocutus. The utility will convert folders of weblocs or individual files to .url files that can be used directly with internet explorer for windows, or any browers in linux or sun.

Leave a Reply

Comments are closed.