Solved

client registry access via JavaScript

Posted on 2002-06-05
15
756 Views
Last Modified: 2012-06-27
Is it possible to access a client workstation registry key value via JavaScript through the web?

If so, how?

thanks
0
Comment
Question by:kbwesler
  • 7
  • 6
  • 2
15 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 7056948
Of course you cannot access the registry with javascript when it came through the web. This is due to security reasons. The only way to do that is when the user explicitly allows you to do that. otherwise it is not possible.

And believe me, users won't allow you to do that.

You are able to do that with ActiveX but due to the vulnerability I won't give you that code...

Why exactly would you want that?

CJ
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7056950
There might be another way to achieve your goals.
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7056953
i dont think so. not that i know what you mean, but i just have never come across this, <grin>
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7056956
which registry are we talking abt here?
0
 

Author Comment

by:kbwesler
ID: 7057080
so the user has to enable active scripting within the browser? is there any other way to pull values from a client registry via a scripting language?
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7057104
Why do you want to do that? What results would you like to achieve?

CJ
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7057111
The user has to enable your website to do that. And it will only work in Internet Explorer and not on AOL or Netscape.

In IE the user will be prompted with a security warning and can then choose whether to allow you or not.

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:kbwesler
ID: 7057142
I have an application which runs in a LAN that saves preferences locally to the client workstation registry.  Then I have a web component to the app that needs to access those registry settings. There has to be a way to achieve this.
0
 

Author Comment

by:kbwesler
ID: 7057155
I have an application which runs in a LAN that saves preferences locally to the client workstation registry.  Then I have a web component to the app that needs to access those registry settings. There has to be a way to achieve this.
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7057171
You really should be using cookies for that purpose and not the registry, that is what they are for.

Okay, so you alreayd have an application? Is it a component? Like ActiveX? If so, the easiest way to achieve your goals is by adding this registry writing to that application and allow that application to run on the client. You cannot tell the application to write or read from a certain client without having the application run on that client (makes sense?).

Cookies are the way to do your stuff from a browser on.

I still don't really get the design that you are using. So I would like to ask some questions.

1) Is it a webinterface? With other words is a page being opened on the client?
2) Does it really have to be registry? I don't recommend it for this purpose, instead you should use cookies.
3) is the web application a true component or plain HTML / Javascript?

CJ
0
 

Author Comment

by:kbwesler
ID: 7057181
cookies are not an option.  It is a web interface and it is only a component or portal to the client/server application.  The preferences that are stored in the registry are different for every workstation.  Yes, it has to access the registry.
0
 
LVL 22

Accepted Solution

by:
CJ_S earned 200 total points
ID: 7057231
Here is a small example. I hope you can understand that I don't like to give away code like this, since it can harm someone's computer, therefore I only give you the read code.

<html>
 <head>
 </head>

 <body>
 <script language="VBScript">

Function RegistryRead(KeyName, ValueName)
  Set WshShell = CreateObject("WScript.Shell")
  RegistryRead = WSHShell.RegRead(KeyName & "\" & ValueName)
End Function

Msgbox RegistryRead("HKEY_CURRENT_USER", "Software\Microsoft\Internet Explorer\Download Directory")

  </script>

 </body>

</html>
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7057234
This is the only way that you won't get the anti-virus software in between btw, other methods using javascript will!!

CJ
0
 

Author Comment

by:kbwesler
ID: 7057235
cookies are not an option.  It is a web interface and it is only a component or portal to the client/server application.  The preferences that are stored in the registry are different for every workstation.  Yes, it has to access the registry.
0
 

Author Comment

by:kbwesler
ID: 7057241
thank you exactly what I was looking for.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now