一、概述
	js 保存到桌面快捷方式 安全有限止了,所以还是得用后台程序来做代码。在网上找了不少资料发现。url可以快捷方式到桌面,但是图标始终不行,所以只能用系统自带的图标。本文附代php源码。
	效果如下图所示:
	 
	图标显示效果跟系统有关系。
	win7系统图标
	
		
	二、两种代码 实现
	1、C#代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class desk_index : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Clear();
        Response.ContentType = "APPLICATION/OCTET-STREAM";
        string HostAddr = "http://www.86y.org";
        
        //解决中文乱码 
        Response.Buffer = true;
        Response.Charset = "gb2312";
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
        Response.AppendHeader("content-disposition", "attachment;filename=\"" + System.Web.HttpUtility.UrlEncode("幸凡学习网", System.Text.Encoding.UTF8) + ".url\"");
        Response.Write("[InternetShortcut] \r\n");
        Response.Write("URL=" + HostAddr + " \r\n"); //快捷方式的外部链接
        Response.Write("IDList= \r\n");
        Response.Write("IconFile=C:\\Windows\\system32\\SHELL32.dll \r\n"); //系统图标文件Dll
        Response.Write("IconIndex=130 \r\n");//第几个
        Response.Write("[{000214A0-0000-0000-C000-000000000046}] \r\n");
        Response.Write("Prop3=19,2 \r\n");
        Response.End();
    }
}
	2、php代码
<?php 
$Shortcut = "[InternetShortcut] 
URL=http://www.86y.org/ 
IconFile=C:\Windows\system32\SHELL32.dll
IconIndex=130    
IDList=
"; 
Header("Content-type: application/octet-stream"); 
header("Content-Disposition: attachment; filename=幸凡学习网.url"); 
echo $Shortcut; 
?>
	三、结语:
	大家也别再纠结自定义图标了,我实在是试了很多办法无果才不得以使用系统图标。希望大家有所收获谢谢。
	(完)