Web page Create Shortcut to desktop multiple ways _php tutorial

Source: Internet
Author: User
We will see a lot of sites not only have set home page, add to the collection at the same time there is a plus and to the desktop shortcut function, below I to introduce you to create shortcuts to the desktop a variety of ways to introduce. If you need a friend, you can refer to it.

The simplest method of JS implementation

The code is as follows Copy Code

Insufficient: Do this if the browser has made security settings we are not able to use the method above.

A friend who writes a PHP program may also know a way to code as follows

The code is as follows Copy Code

$Shortcut = "[Internetshortcut]

Url=http://www.bkjia.com

Iconfile=http://www.bkjia.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= transformation without worry. url ");

Echo $Shortcut;

?>


Send to Desktop


ASP. NET programmers may also know the following code

The code is as follows Copy Code
Using System;
Using System.Data;
Using System.Configuration;
Using System.Collections;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Web.UI.HtmlControls;
public partial class CreateShortcut:System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
}
///
Create a shortcut
///
///Title
///URL address
private void CreateShortcut (String Title, String URL)
{
String Strfavoritefolder;
Create IE shortcuts in Favorite Folders
Strfavoritefolder = System.Environment.GetFolderPath (Environment.SpecialFolder.Favorites);
Createshortcutfile (Title, URL, Strfavoritefolder);
Creating IE shortcuts in the desktop
Strfavoritefolder = System.Environment.GetFolderPath (Environment.SpecialFolder.Desktop);
Createshortcutfile (Title, URL, Strfavoritefolder);
Create IE shortcuts in links
Strfavoritefolder = System.Environment.GetFolderPath (Environment.SpecialFolder.Favorites) + "link";
Createshortcutfile (Title, URL, Strfavoritefolder);
Create IE shortcuts from the Start menu
Strfavoritefolder = System.Environment.GetFolderPath (Environment.SpecialFolder.StartMenu);
Createshortcutfile (Title, URL, Strfavoritefolder);
}
///
Create a shortcut
///
///Title
///URL address
///Special folders
private void Createshortcutfile (String Title, String URL, String specialfolder)
{
Create shortcut file, based on Title
System.IO.StreamWriter objwriter = System.IO.File.CreateText (specialfolder + "+ Title +". url ");
Write URL to File
Objwriter.writeline ("[Internetshortcut]");
Objwriter.writeline ("url=" + URL);
Close file
Objwriter.close ();
}
private void Btnshortcut_click (object sender, System.EventArgs e)
{
CreateShortcut ("Home of the Script", http://www.bkjia.com);
}
}

http://www.bkjia.com/PHPjc/444613.html www.bkjia.com true http://www.bkjia.com/PHPjc/444613.html techarticle we will see a lot of sites not only have set the homepage, add to the collection at the same time there is a plus and to the desktop shortcut function, below I give you introduce the page to create a shortcut to the desktop ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.