4

我的网站可以选择通过单击链接将快捷方式 (.url) 文件下载到用户的 PC 上。这个想法是用户可以将其保存到他们的桌面,并将其用作站点的快捷方式以供将来访问。(我知道这很古怪,但这是我的客户想要的。)

我有一个我希望使用的 icon(.ico) 文件,但是每当用户下载该文件时,该图标都不会显示。

我尝试在记事本中打开 URL 文件并编辑 IconFile 值以指向服务器本身的图标文件。

[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
[InternetShortcut]
URL=http://example.com/
IDList=
HotKey=0
IconFile=http://example.com/favicon.ico
IconIndex=0

但是,这似乎不起作用。谁能建议可能出了什么问题,或者我该如何解决。

4

1 回答 1

5

MS Windows does not load icon files specified with ´IconFile´ from the internet (for security reasons, I guess).

Rather it only loads the ´IconFile´ from

  • local file if the path is a file path, or
  • local web cache if the protocol is http:

You can verify this by navigating Internet Explorer to http://example.com/favicon.ico (now file is in cache) and then refreshing your *.url file (by right-clicking -> Edit -> [Make a fake change])

Now the icon should be displayed. Now clear your IE-cache, refresh *.url file, and the icon is gone (replaced by the icon of the default browser)

So,

  • either your client can tolerate that the default icon is displayed if icon is not cached, or
  • you have to provide a local copy.
于 2014-05-28T21:59:48.107 回答