Wednesday, May 22, 2019

What do linux internet shortcuts look like (extension and contents)?


I don't have a linux computer currently running, and I don't remember what linux's internet shortcuts look like. I need to know, so I can create one for linux users I'm distributing content for.


What extension does linux's internet shortcut files use? What do their contents look like? Is it similar to Windows or MacOS? Do different linux distributions have different types?


Answer



They take one of two forms:



  • An HTML file using either JavaScript or a tag. This is dependent on a lot of factors to work right (not just on Linux, but on all platforms), namely the user has to have the file set up to open in a web browser, and they have to have whichever method you want to use enabled in their browser (users can and do have either or both disabled), and the browser has to honor it properly for file:/// URL's (most will for the JavaScript, but some don't honor the tag correctly for file:/// URL's).


  • A FreeDesktop.org Desktop Entry file (info on the exact format can be found on the FD.O site). This is the most reliable method on Linux, as i will work out of the box without issue on most distributions, and with minimum work on those it doesn't (namely, you just need to make sure that the user has execute permissions on the file).



A typical link thus looks something like this:


[Desktop Entry]
Name="example.com"
Type="Link"
URL="https://example.com"

The above file will show up with a name of 'example.com' in all major desktop environments and when double clicked will cause https://example.com to be opened in the user's preferred web browser.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...