PHP generates website Desktop shortcuts for code sharing and php shortcuts
The PHP desktop shortcut is so simple that you can change the website you want to generate when you generate it.
Dianji.html code:
Copy codeThe Code is as follows:
<A href = "a. php? Url = www.jb51.net & name = "> Generate a left-side shortcut </a>
Shengcheng. php code:
Copy codeThe Code is as follows:
<? Php
// The left-side shortcut for website survival --- Function
$ Url = $ _ GET ['url'];
$ Filename = urldecode ($ _ GET ['name']);
$ Filename = iconv ('gbk', 'utf-8', $ filename); // Character Set conversion (no conversion is required)
If (! $ Url |! $ Filename) exit ();
$ Shortcut = "[InternetShortcut]
URL = {$ url}
IDList =
[{000214A0-0000-0000-C000-000000000046}]
Prop3 = 19,2 ";
Header ("Content-type: application/octet-stream ");
Header ("Content-Disposition: attachment; filename = {$ filename}. url ;");
Echo $ Shortcut;
?>
Use PHP to write a download page to the desktop shortcut code. After the website is opened, the following question is displayed. How can this problem be solved?
You need to write a separate page to create a shortcut. I guess you have output content on the page before that, so you have an error
A. php
----------------------------------
$ Url = $ _ GET ['url'];
$ Filename = urldecode ($ _ GET ['name']);
$ Filename = iconv ('utf-8', 'gbk', $ filename); // Character Set Conversion
If (! $ Url |! $ Filename) exit ();
$ Shortcut = "[InternetShortcut]
URL = {$ url}
IDList =
[{000214A0-0000-0000-C000-000000000046}]
Prop3 = 19,2
";
Header ("Content-type: application/octet-stream ");
Header ("Content-Disposition: attachment; filename = {$ filename}. url ;");
Echo $ Shortcut;
Create a hyperlink when generating
<A href = "a. php? Url = webpage address & name = shortcut name "> shortcut </a>
Code for creating a desktop shortcut for a website
Is a piece of js Code. Baidu search JS creates a desktop url shortcut
Html code
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "www.w3.org/..al.dtd">
<Html xmlns = "www.w3.org/5o/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> untitled document </title>
</Head>
<Body>
<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 ("the current IE security level does not allow operations! ");
}
}
</Script>
<Input name = "btn" type = "button" id = "btn" value = "Create a Netease shortcut to the desktop" onClick = "toDesktop ('HTTP: \ // www.163.com/', 'net ') ">
</Body>
</Html>