By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,663 Members | 1,271 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,663 IT Pros & Developers. It's quick & easy.

Error while creating desktop shortcut

P: 2
Hi All,

Iam using the following JavaScript to create desktop shortcut

Expand|Select|Wrap|Line Numbers
  1. function createShortcut() {
  2.         if (ActiveXObject) {
  3.             // Create desktop shortcut
  4. WshShell = new ActiveXObject( "WScript.Shell" );
  5.             strDesktop = WshShell.SpecialFolders("Desktop");
  6.             oShellLink = WshShell.CreateShortcut(strDesktop + "\\My Shortcut.lnk");
  7.             oShellLink.TargetPath = url;
  8.             oShellLink.WindowStyle = 1;                
  9.             oShellLink.Description = "some description";
  10.             oShellLink.WorkingDirectory = strDesktop;
  11.             oShellLink.Save();
  12.                                }
  13. }
For most of the browser this is working fine but for some a javascript error is shown at line number pointing to oShellLink.Description = "some description";

the error is as follows :

Line: 343
Char: 7
Error: Object doesn't support this action

Code: 0

Can anyone tell what might be the problem? Is it the browser version or OS version or some security setting??

Thanks in advance
Feb 7 '07 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 15k+
P: 16,027
This will only work in IE.

See this page on MSDN which deals with a similar example to yours. Maybe you can leave out the description line and see if that works.
Feb 7 '07 #2

P: 2
Thanks for your reply.
Do we have any restriction on the Windows operating system or Internet explorer browser version for this to function without any problems?

Feb 13 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.