Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The .url file doesn't load the icon

I have developed a servlet that generates a .url file and send it to the user. The target is to let the user access to the web application without entering the username and password data, by double-clicking the .url file downloaded. The .url File has the following format:

[DEFAULT]
BASEURL=http://{SERVER}/login?action=directAccess&userName={USERNAME}&passw={ENCRIPTED_PASSWORD}
[InternetShortcut]
URL=http://{SERVER}/login?action=directAccess&userName={USERNAME}&passw={ENCRIPTED_PASSWORD}
IconIndex=0
IconFile=http://{SERVER}/resources/favicon.ico 

I know that this solution only works in Windows OS but I have no problem with this because all the clients that use the web application use windows as OS.

The problem is that the .url file downloaded doesn't load the icon indicated on the file in some cases ( Windows 7 or higher OS), so the icon showed is the default browser icon. Is there any solution?

Thx very much!

like image 876
Alejandro Ruiz Arias Avatar asked Sep 24 '13 08:09

Alejandro Ruiz Arias


3 Answers

I believe this issue is based on Windows 7 and newer using a .website file and not a .url file. Here are examples of both using google.com.

.url syntax:

[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
IDList=
URL=https://www.google.com/

.website syntax:

[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
Prop4=31,Google
[InternetShortcut]
IDList=
URL=https://www.google.com/
IconFile=https://www.google.com/favicon.ico
IconIndex=1
[{A7AF692E-098D-4C08-A225-D433CA835ED0}]
Prop5=3,0
Prop9=19,0
[{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}]
Prop5=8,Microsoft.Website.9CB8E698.C9795A8C

A .url file will simply download the /favicon.ico of the site if available, but fall back to the http icon of your default application (Chrome or IE's icon, etc). A .website file you can specify the icon to use including providing higher quality icons that wouldn't be included in the favicon.ico file. The downside to using a .website file is that it will open IE and not the user's default web browser. The upside is you get a custom icon and possibly more functionality because you can have jump lists, badges, etc. IE Dev Center

like image 105
ManOVision Avatar answered Nov 10 '22 17:11

ManOVision


The IconFile needs to be accessible within the filesystem. That said, either find a way to download it locally (e.g., while installing a corporate package) or make it available within a file share (which, although remote, is treated in a special way by Windows). That cleaver trick would result in:

IconFile=\\{SERVER}\resources\favicon.ico 

It assumes the same webserver is available online (or within your Intranet, depending on target audience) and has a file share named resources (proper share and file permissions and firewall adjustments necessary) pointing to the same location served by the referred HTTP address.

Reference: Distributing an Internet Shortcut file with a custom icon

like image 41
Helder Magalhães Avatar answered Nov 10 '22 16:11

Helder Magalhães


To work around this problem, set the icon path of the Internet shortcut manually. To do this, follow these steps:

  1. Right-click the Internet shortcut, and then click Properties.

  2. Click the Web Document tab, and then click Change Icon.

  3. Locate the folder that contains the icon, and then click the icon for the Internet shortcut.

It works even if it is a document for IE7

Reference: https://support.microsoft.com/en-us/help/935779/fix-an-internet-shortcut-does-not-display-the-correct-icon-in-internet-explorer-7

like image 24
Fabio Avatar answered Nov 10 '22 17:11

Fabio