Results 1 to 9 of 9
  1. #1


    Member Since
    Feb 19, 2014
    Posts
    5
    Cool How to Get Domain Information using Javascripting
    HI all,

    How do I fetch my MAC "Domain" information programatically using javascripting.

    I Tried using the below code to get the user information.

    alert($.getenv("USER"))

    But not able to get the "Domain" information.
    Any help on this will be much appreciated.


    Shaji

  2. #2

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,735
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    Are you trying to get the domain information or the MAC address (letter case, in this example, matters quite a bit)? If you're looking for the domain, try document.domain. If you're looking for the MAC address, I fear you may be out of luck - I doubt JavaScript can access that kind of information as the JS engine in your browser of choice is likely sandboxed and too far abstracted from the machine.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  3. #3


    Member Since
    Feb 19, 2014
    Posts
    5
    Thank you so much for the response.
    We are trying to get the "domain" name only.

    I tried as you suggested.

    alert($.getenv("document.domain")) but I am getting output as "null".

    We are running the JavaScript as a standalone, not through browser.
    I there is any other method. Please advice.

    Shaji

  4. #4

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,735
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    You don't need to use getenv - just straight up document.domain. So,
    Code:
    alert(document.domain)
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  5. #5


    Member Since
    Feb 19, 2014
    Posts
    5
    Thanks for the valuable suggestion.

    We are not getting the result as expected, it showing "Null".

    Shaji

  6. #6

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,735
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    When you say "standalone", are you referring to running this locally? If so, that would be why (I would have imagined that it might spit back localhost but null makes a bit of sense).
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  7. #7


    Member Since
    Feb 19, 2014
    Posts
    5
    yes, we are running this locally.
    We have a "ExtendScript Tool Kit CS6" by which we are using to create "javascripts" for applications like, indesign, illustrator etc...

    This editor supports all "javascripts" syntax. Our goal is to catch the MAC machine "domain" name before executing the scripts for automation purpose, if the "domain" is not pertaining to our company the subsequent script won't work, this is for security purpose for not hacking our scripts by others.

    We have Windows and MAC machines with us. Successfully implemented for windows with the same "syntax" which i posted in my first discussion.

    But we are unable to get the domain names in MAC, so I thought of positing it in the MAC forum.

    Shaji

  8. #8

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,735
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    Try window.location.hostname - that should work for you.

    Just as a note - MAC means something different than Mac (this is especially important when talking about networking). The former refers to an identifier for networking interfaces, the latter to the Apple branded machines. I don't normally correct people on this but if you're talking about networking issues, it's important to differentiate the two.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  9. #9


    Member Since
    Feb 19, 2014
    Posts
    5
    Thank you for your valuable suggestion and responses on this topic.

    Since its a "script editor" the syntax which you have given did't work.

    We dropped executing it through the "Script Editor". Now we are running it in the "Terminal", which we got the result.

    Thanks...

    Shaji

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Domain name help
    By guil7y in forum Web Design and Hosting
    Replies: 4
    Last Post: 06-02-2010, 10:37 PM
  2. Replies: 0
    Last Post: 09-23-2009, 10:24 AM
  3. Can't resolve a particular domain
    By jshalvi in forum OS X - Operating System
    Replies: 4
    Last Post: 04-19-2009, 10:35 PM
  4. Win2003 domain
    By steffo76 in forum Internet, Networking, and Wireless
    Replies: 1
    Last Post: 12-08-2004, 11:02 PM

Posting Permissions

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