<?php
$Shortcut = "[InternetShortcut]
URL=http://www.php114.net/
IDList=
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
";
Header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=php114.url;");
echo $Shortcut;
?>
<%
Response.ContentType="APPLICATION/OCTET-STREAM"
Response.AddHeader "Content-Disposition","attachment;filename="&"php114.url"
Response.Write("[InternetShortcut]")&Chr(13)
Response.Write("URL=http://www.php114.net")&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
%>
<script language="JavaScript">
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安全级别不允许操作!请设置后在操作.");
}
}
</script>
<input name="btn" type="button" id="btn" value="创建的快捷方式" onClick="toDesktop('http://www.php114.net/','php114')"
js方法2 仿开心网
view sourceprint?
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=php114.url");
echo $Shortcut;
}
Intent viewIntent = new
Intent("android.intent.action.VIEW",Uri.parse("http://m.oschina.net"));
startActivity(viewIntent);
Intent viewIntent = new
Intent("android.intent.action.VIEW",Uri.parse("http://m.oschina.net"));
startActivity(viewIntent);