I've changed the default application for opening .webloc
files to Firefox (using RCDefaultApp, nice piece of kit, that) and that's all fine, except for one bit of weirdness. If I create a .webloc
using a script (I'm using a Perl script adapted from this one to create spotlight-searchable bookmarks) then it opens up in Firefox as a bit of unstyled XML (with the "This XML file does not appear to have any style information associated with it. The document tree is shown below" header).
Now here's the weirdness: if I drag a URL from the Firefox URL bar onto the desktop, I get a .webloc
file that is opened by Firefox with no problems - but when I look at the contents it's completely identical to the one I created with my script. It has to be something to do with the file creator - if I open the Firefox-created .webloc
file and then save it from a text editor, it no longer works.
So what's going on? How do two identical bits of XML open differently depending on how they were created? Is there some magic bit somewhere I can change?
For reference, here is the contents of a .webloc
file as created by my script (I'd put the one created by Firefox as well, but since it's completely identical (I checked with diff) there's no point):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>URL</key>
<string>http://www.spacetelescope.org/</string>
</dict>
</plist>
ls -l@ /path/to/file
, and show their contents withxattr -l /path/to/file
.