【推荐理由】赠运费险
【优惠券】20 【券后价】59.00
【下单链接】18¥ CZ0001 G5fHdEqOsnB¥
为了支持所有浏览器,我们可以用动态语言来做。
<?php $Shortcut = "[InternetShortcut] URL=http://www.tshinet.com IconFile=http://www.tshinet.com/favicon.ico IconIndex=0 HotKey=1613 IDList= [{000214A0-0000-0000-C000-000000000046}] Prop3=19,2"; header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=温州网站建设.url"); echo $Shortcut; ?>
HTML中的代码:
<a href="tshinet.com.php" target="_blank">创建桌面快捷方式</a>
另一种方法是用js来实现:
functionCreateShortcut() { try{ varfso = newActiveXObject("Scripting.FileSystemObject"); varshell = newActiveXObject("WScript.Shell"); vartagFolder = shell.SpecialFolders("Desktop"); if(!fso.FolderExists(tagFolder )) { fso.CreateFolder(tagFolder); } if(!fso.FileExists(tagFolder + "\\温州天时网站建设.lnk")) { varWshSysEnv = shell.Environment("Process"); iLocal = (WshSysEnv.Item("SystemRoot") +"\\1.ico"); //下载到C:\windows\1.ico iRemote = ("/Images/2.ico"); //先下载图标文件,再用自定义图标把首页的图标地址替换 varxPost = newActiveXObject("Microsoft.XMLHTTP"); xPost.Open("GET", iRemote, 0); xPost.Send(); varsGet = newActiveXObject("ADODB.Stream"); sGet.Mode = 3; sGet.Type = 1; sGet.Open(); sGet.Write(xPost.ResponseBody ); sGet.SaveToFile( iLocal,2); varlink = shell.CreateShortcut(tagFolder + "\\温州天时网站建设.lnk"); link.Description = "打开基本软件的快捷方式"; link.Hotkey = "Ctrl+Alt+e"; link.TargetPath = "http://www.tshinet.com/"; link.IconLocation=iLocal; link.WindowStyle = 3; link.WorkingDirectory = "c:\\blah"; link.Save(); alert("恭喜!快捷方式创建成功!"); } } catch(ex){ alert("快捷方式创建失败,可能浏览器不支持!"); } }
由于js创建快捷方式经常会被拦截,提示安全问题,而不必执行,所以推荐第一种方式。