Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
779 views
in Technique[技术] by (71.8m points)

.net - Creating a Desktop Shortcut Using a Web Page

I am trying to create something on a webpage that allows my users to create a desktop shortcut. Because my users are NOT technically savvy, I would like to avoid having them try to drag and drop.

Is there a way that I could create a button on a webpage (either using JavaScript or .Net) that automatically creates a desktop shortcut for the user??

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Easy way: Using what the browsers offer

In Firefox, dragging & dropping a link to the desktop creates a shortcut in Windows 7. I'm sure all or most major browsers can do this on most platforms. Just point your users to the right direction, maybe by offering them custom step-by-step instructions.

You can style the link as a huge area easy to recognize, drag and drop. No need for it to be just an underlined piece of text.

This is, in my opinion, the only worthwhile way to go.

Hard way: Programming it yourself

I don't think creating a desktop link can be done using JavaScript - there will be too many security restrictions in place blocking it.

For Windows, I think the closest thing would be generating shortcut .lnk files on server side, and offering those for download. It's not trivial though, and its structure is not documented by Microsoft. There are unofficial guides like this: The Windows Shortcut File Format

You may be able to get around generating the files by creating them on your local system, and offering them for download. It may work if you use absolute web addresses - you'd have to try out. Don't forget to test on the various systems: 95, 98, XP, Vista, 7 ....

I'm sure there are equivalent shortcut formats on Mac OS and the various Linux Desktops, but I don't know them.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...