How to save a website shortcut on your desktop using java script ?
Asked
Active
Viewed 986 times
-3
-
You mean, `Ctrl+S`? – user7393973 Feb 15 '17 at 11:11
-
please explain better your needs – MrPk Feb 15 '17 at 11:12
-
I need a button that will save a shortcut of my website on my machine's desktop help with the code please – Anele.Sean Feb 15 '17 at 11:20
-
It's possible with IE and `Wscript.Shell` ActiveX object __only__, probably it's not what you're looking for. + No-one really should allow executing arbitrary ActiveXs via a web page. – Teemu Feb 15 '17 at 11:22
-
And what if the client system does not have a desktop? – arkascha Mar 10 '17 at 13:30
2 Answers
2
Using JavaScript this is not possible, it is a security feature implemented by browsers. Spammy websites would abuse this feature.

Dylan Kilkenny
- 325
- 4
- 13
-
1[Source](http://stackoverflow.com/questions/13509736/javascript-create-desktop-link-programmatically), second comment. – user7393973 Feb 15 '17 at 11:14
-
It is actually not impossible, since browsers can use [`beforeinstallprompt`](https://developer.mozilla.org/en-US/docs/Web/API/Window/onbeforeinstallprompt) to create desktop shortcuts. – Anderson Green Mar 04 '22 at 23:10
0
I don't think it is possible : adding to desktop is an OS thing ; JS through browser is not allow to do that. I might be wrong but I'll be surprised.
You can invite the user to do so in a nice enthusiastic modal though!

hsolatges
- 3
- 6