Results 1 to 5 of 5

Thread: Can Javascript read and check windows registry?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Posts
    79

    Question Can Javascript read and check windows registry?

    Dear Gurus and members,

    I am a newbie in Javascript. I would like to know whether can JavaScript check and read windows registry? I am planning to develop a plugin using media control interface(MCI) that will store a value in the registry during the 1st time installation. If the user click on a button, javascript will check the user's computer to see if the value exist on the user's computer. If not, it will ask user to download the plugin before allowing the user to use the record/playback plugin. Otherwise, it will display the record/playback pop up window.

    My concern is whether can Javascript check and read the value in the windows registry? If yes, can someone please share the sample codes with me?

    I have a code written in VBScript but I am not sure how to 'translate' the codes to Javascript. The codes are as below:

    'VBScript to check registry
    Option Explicit
    Dim WSHShell, RegKey, RecPlay
    Set WSHShell = CreateObject("WScript.Shell")

    RegKey = " HKEY_LOCAL_MACHINE\SOFTWARE\COMPANYNAME\IEBSOUNDRE
    CORDING"

    RecPlay = WSHShell.RegRead(RegKey & "ONE.EXE") 'plugin name

    If RecPlay = 1 Then
    ' display plugin
    ' do start the program

    Else
    'request download plugin
    'response.redirect(url)
    End If

    ' End code

    Any suggestions and ideas are highly appreciated. Hope to hear some reply soon.

    Thanks in advance,
    Janice

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    AFAIK, you cannot use JavaScript to read the registry, just VBScript. Something to do with the WScript object

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    You can do this in VBScript or JScript from Internet Explorer but the create object will cause a message to be displayed to the user confirming they want to run the AtiveX object.

    The question you've got to ask is. Would you give any tom, dick or harry access to your registry?

    May I suggest you use cookies instead. This means your solution will work accross all browsers and does not come with the same security risks as using the registry does.

    Attached Images Attached Images  
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Posts
    79
    Thanks mendhak and visualAd.

    There are quite alot of developers and people who has the same idea. However, I fond a site that claims it can be done:
    http://www.securiteam.com/exploits/5FP080A5FM.html

    I am very confused, as I am a total newbie in Javascript. Can anyone please give me a clearer idea?

    By the way, if the registry is replaced by .txt file? Can Javascript read/check for the existance of a .txt file in the user's computer? I don't require writing or changing, just to check whether the .txt file exist. If exist, it will display plug-in. Otherwise, it will request user to download.

    Hope to hear some ideas and suggestions soon as this is urgent.

    Thanks in advance,
    Janice

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    No, you can't do that either. For the same reason, security.

    If it's a real proper plugin then I think you should be able to change some properties in the navigator JS object that you can query with JS.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width