views:

90

answers:

2

I asked a similar question a while ago but didn't get a satisfactory answer, so I was wondering if there was a different approach a guy could take.

What is the format for making a web link that you can deploy with your application? One that might show up in the start menu as a link to said app vendor's website.

It should work in any modern OS and with any reasonably modern browser (i.e. >= IE6, although I'm not sure that's a relevant issue)

+1  A: 

There is no cross-platform way to do this.

  • Freedesktop-compliant systems can use xdg-open
  • Mac users can use open
  • Debian derivatives can use sensible-browser (or install xdg-open, usually)
  • Windows users can use *.url files
  • Or, of course, you could implement xdg-open and package it with your app on systems that don't have it
  • Or implement your own util that's completely different and associate it with the right files
singpolyma
A: 

The format is different on different platforms.

On Windows, you can use a .url file. Here's a description of the format. You can also create one by just dragging a URL onto the desktop or into a folder. A simple example:

[InternetShortcut]
URL=http://stackoverflow.com/

On the Mac, you can also create a URL file by dragging a URL to the desktop. The format appears to be a file with a .webloc extension, containing a plist containing a dict, mapping the key URL to the URL in question:

<?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"&gt;
<plist version="1.0">
<dict>
    <key>URL</key>
    <string>http://stackoverflow.com/&lt;/string&gt;
</dict>
</plist>
Brian Campbell