I would like to create a file that when double clicked launches a website in the default web browser. I have found that .desktop
files can do this, but apparently they no longer work in Ubuntu 22.04.
How can this be done?
I would like to create a file that when double clicked launches a website in the default web browser. I have found that .desktop
files can do this, but apparently they no longer work in Ubuntu 22.04.
How can this be done?
You can use an html file that launches in the default browser and immediately redirects to your target website with the
http-equiv=refresh
attribute on the<meta>
element. The target website address goes to thecontent
attribute which must be a non-negative integer followed by the string';url='
, and your URL. The integer is the number of seconds until the page should redirect - in this case0
is a convenient value.If you have a link to your website on a page in Firefox, you can actually drag the link and drop it on the desktop to create such a file (this is how I accidentally found this solution while playing around with links and desktop launcher files). Or, create the file manually.
For example the following file will open and redirect to askubuntu.com: