php网址桌面快捷图标,保存链接到桌面、设为桌面快捷方式的js、php、asp代码带图标...

保存链接到桌面、设为桌面快捷方式的php、asp代码_众多像我一样的个人站长们的问题

[js方法]

function toDesktop(sUrl,sName)

{

try

{

var WshShell =

new ActiveXObject(“WScript.Shell”);

var oUrlLink =

WshShell.CreateShortcut(WshShell.SpecialFolders(“Desktop”) +

“\\”

+ sName +

“.url”);

oUrlLink.TargetPath = sUrl;

oUrlLink.Save();

}

catch(e)

{

alert(“当前IE安全级别不允许操作!请设置后在操作.”);

}}

type=“button“

id=“btn“

value=“创建的快捷方式“

onClick=“toDesktop(‘http:\//www.boshi8.com/’,'博士吧’)“>

[仿开心网的设为桌面]

public function

shortcutAction()

{

$this->_helper->layout->disableLayout();

$this->_helper->viewRenderer->setNoRender(

true );

$url = site_url();

$Shortcut = ”

[InternetShortcut]

URL=”.$url.”

IDList=IconIndex=43

IconFile=/favicon.ico

HotKey=1626

[{000214A0-0000-0000-C000-000000000046}]

Prop3=19,2″;

Header(“Content-type: application/octet-stream”);

header(“Content-Disposition: attachment; filename=开心网.url”);

echo $Shortcut;

}

[ASP方法]

就会有提示下载一个名为 宅急信-青城最及时的房屋信息网.url 文件,保存在本地就是一个快捷方式!

1、将下面的代码保存为文件,shorturl.asp。记得修改第二行及第四行内的url名称和网址。

Response.ContentType=”APPLICATION/OCTET-STREAM”

Response.AddHeader

“Content-Disposition”,”attachment;filename=”&”博士吧设计.url”

Response.Write(“[InternetShortcut]“)&Chr(13)

Response.Write(“URL=http://www.cnarrow.com”)&Chr(13)

Response.Write(“IDList=”)&Chr(13)

Response.Write(“[{000214A0-0000-0000-C000-000000000046}]“)&Chr(13)

Response.Write(“Prop3=19,2″)&Chr(13)

Response.End

%>

2、将该文件上传至网站根目录。

3、在网站根目录上传Favicon.ico文件,有这个文件,保存的链接才会有图标显示。

4、在网站调用页面添加如下代码即可。

href=’http://www.boshi8.com/shorturl.asp’>桌面图标

[PHP方法]

另附PHP代码,大家可以尝试一下,保存成shorturl.php即可,调用方式同asp。

$Shortcut = “[InternetShortcut]

URL=http://www.cnarrow.com/

IDList=

[{000214A0-0000-0000-C000-000000000046}]

Prop3=19,2

“;

Header(“Content-type: application/octet-stream”);

header(“Content-Disposition: attachment; filename=宏箭.url;”);

echo $Shortcut;

?>

要想出现图标请先确保网站根目录中有 favicon.ico

文件上传到网站保存链接到桌面、设为桌面快捷方式的js、php、asp代码_

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值