36

Is there any way to create Internet shortcut files that will work with all operating systems (including Mac, Windows, and Linux)? I often switch between Windows and Linux, and I haven't yet found a way to create an internet shortcut file (on the desktop or in a local folder) that is compatible with all operating systems.

5 Answers5

34

I found a reasonable cross-platform solution. This HTML document could be used as a shortcut to stackoverflow.com, and it would immediately redirect to that site when opened from the desktop:

<html>
<body>
<script type="text/javascript">
    window.location.href = "http://stackoverflow.com"; //change this to the URL
                                                       //you want to redirect to
</script>
</body>
</html>
23

You can define a file named as following - MyInternetShortcut.url.

It's content should be:

[InternetShortcut]
URL=https://my.amazingsite.com/

This works on Windows and macOS.

Royi
  • 621
  • 2
  • 14
  • 26
20

Credit to Evan Mattson from the comments.

From W3C, Technique H76: Using meta refresh to create an instant client-side redirect:

The objective of this technique is to enable redirects on the client side without confusing the user. Redirects are preferably implemented on the server side (see SVR1: Implementing automatic redirects on the server side instead of on the client side (SERVER) ), but authors do not always have control over server-side technologies.

Example from the link above:

<html xmlns="http://www.w3.org/1999/xhtml">    
  <head>      
    <title>The Tudors</title>      
    <meta http-equiv="refresh" content="0;URL='http://thetudors.example.com/'" />    
  </head>    
  <body> 
    <p>This page has moved to a <a href="http://thetudors.example.com/">
      theTudors.example.com</a>.</p> 
  </body>  
</html>

Basically, a refresh is done after zero seconds (immediately) to the specified URL, before the page content is loaded, and without JavaScript.

Cadoiz
  • 567
tavnab
  • 308
1

For ease of use, I wrote a script to generate .url-files like Royi suggested in his answer. Making this script runnable with e.g. chmod +x url_linkscript.sh makes things even more handy. This file contains:

#!/bin/bash
echo "[InternetShortcut]
URL=$1" > "$2"

You can then run it like this: $ url_linkscript.sh "https://my.amazingsite.com/" "result.url". (Depending on your link and file name, this usually also works without the quotes ".)

Cadoiz
  • 567
0

SurlfBird solves a long-standing problem. You run a Windows desktop computer and an iPhone/iPad side by side. You use a shared file storage like owncloud, nextbox, dropbox, webdav or something similar to transfer your data between the devices. This works fine for office documents, text documents. If, like me, you like to save URLs from internet sessions in your shared storage for later reading or as a reminder, you will find a .url file when viewing the replicated storage on the iOS device. You can copy its contents to the Notes application and click the link there. Now you have SurlfBird to help you. Just share the url file with SurlfBird and it will grep the URL from the .url file and open Safari with that URL. Very small and simple application, no extra internet traffic or anything.

https://apps.apple.com/de/app/surlfbird/id6587562760