Tuesday, May 7, 2024
 Popular · Latest · Hot · Upcoming
24
rated 0 times [  24] [ 0]  / answers: 1 / hits: 15660  / 2 Years ago, wed, may 4, 2022, 9:58:31

An URL link has been saved in *.url file via Windows. If you double click the file in Windows, it will open your default browser to the indicated URL.
Here is an example of *.url file content:


[InternetShortcut]
URL=http://abdennour-insat.blogspot.com/

When the same file is copied on Ubuntu OS, Ubuntu handles it such as a text file. Hence, the browser does not open the URL when double-clicking the file.


My question is: what is the equivalent of *.url file in Linux to make shortcut file for URLs?


More From » filemanager

 Answers
4

In Ubuntu an URL shortcut is stored in a .desktop file as follow (for example):



[Desktop Entry]
Encoding=UTF-8
Name=Link to Best Practices Software engineering
Type=Link
URL=http://abdennour-insat.blogspot.com/
Icon=text-html


If you still want to open your Windows URL files in Ubuntu, here is described how you can do it:





The Perl script given in that article appears to be broken, but the following code should do the same thing correctly:



#!/usr/bin/perl
# Script to make Microsoft Windows Internet Shortcuts (*.url) work on Linux.

my $browser = 'sensible-browser'; # use the system default browser

while (<>) {
# match any line of the form "URL = something-without-spaces"
if (/^s*URLs*=s*(S+)s*$/) {
exec $browser, $1; # successful exec never returns
die "$0: could not launch $browser: $!
";
}
}

[#29160] Friday, May 6, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
antebrow

Total Points: 291
Total Questions: 135
Total Answers: 117

Location: New Caledonia
Member since Thu, Mar 23, 2023
1 Year ago
;