用php或asp创建网页桌面快捷方式的代码

发布时间:2011年04月02日      浏览次数:732 次
一、新建一个PHP文档:名字好记就行如:desktop_url_link.php
PHP文档中的内容:
代码如下:
<?php
$Shortcut = "[InternetShortcut]
URL=http://www.hao513.com/?desktop
IDList=
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
";
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=".urlencode("桂林视窗生活网").".url;");
echo $Shortcut;
?>
要想出现图标请先确保网站根目录中有 favicon.ico 文件
上传到网站,访问地址:如:http://www.hao513.com/desktop_url_link.php 就会有提示下载一个名为 桂林视窗生活网.url文件,保存在本地就是一个快捷方式!
===================================================
下面是asp实现代码:
<%
id=int(request("id"))
if id="" then id="1"
title=request("title")
If title="" Then title="桂林视窗生活网"
Shortcut = "[InternetShortcut] " & vbCrLf
Shortcut = Shortcut & "URL=http://www.hao513.com/?desktop" & vbCrLf
Shortcut = Shortcut & "IDList= " & vbCrLf
Shortcut = Shortcut & "[{000214A0-0000-0000-C000-000000000046}] " & vbCrLf
Shortcut = Shortcut & "Prop3=19,2 " & vbCrLf
Shortcut = Shortcut & " " & vbCrLf
Response.AddHeader "Content-Disposition", "attachment;filename="&title&".url;"
Response.ContentType = "application/octet-stream"
Response.Write Shortcut
%>
需要注意的是,因为可能安全问题导致被锁定
需要如下操作,在"桂林视窗生活网.url"--》右键--》属性--》解除锁定 即可访问,这个就像网上下载的chm文件一样需要类似的操作。
免责声明:本站相关技术文章信息部分来自网络,目的主要是传播更多信息,如果您认为本站的某些信息侵犯了您的版权,请与我们联系,我们会即时妥善的处理,谢谢合作!