How to create cross-platform Internet shortcut files

19

11

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.

Anderson Green

Posted 2013-01-18T07:11:01.880

Reputation: 5 214

2018 update: macs can handle .url files, though they default to Safari. Linux and Android do not handle .url. https://chrome.google.com/webstore/detail/webcuts/kehckhdcknjaadegmihldoedmdfmpcmk can make xplatform links for you.

– Ray Foss – 2017-12-11T18:34:43.030

Answers

20

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>

Anderson Green

Posted 2013-01-18T07:11:01.880

Reputation: 5 214

21Why not use <meta http-equiv="refresh" content="0; url=http://example.com/"> in the <head> instead of relying on javascript? – Evan Mattson – 2014-09-11T00:23:27.560

1this is such a fantastically simple solution... thank you – Nick Franceschina – 2013-01-29T00:27:05.080

14

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.

tavnab

Posted 2013-01-18T07:11:01.880

Reputation: 241

5

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

Posted 2013-01-18T07:11:01.880

Reputation: 276

Maybe your Linux. Opens in text editor on my Linux Mint 17.3 Mate system. – kreemoweet – 2019-02-10T19:10:58.240

I have Linux Mint 18.3 and it doesn't work as well. I guess my memory tricked me. It does work on macOS and Windows. I will update the answer. Thank You. – Royi – 2019-02-10T20:58:59.197