1

I have a javascript function to retrieve the users workstation like the one here. How can I read the client's machine/computer name from the browser?

My question is, how can I pass the computername (result from the function) to the servlets doGet() method?

Currently my code (snippet) that calls the servlet is as follows:

    <html>
    <head> .... <script> load my javascript file here </script></head>
    <%
      if(session.getAttribute("Login") == null){
         //I want to pass the computer name here
         response.sendRedirect("../LOGME");
      } else {
        //draw page body
      } %>
     </html>
Community
  • 1
  • 1
GoAlves
  • 435
  • 3
  • 5
  • 16

1 Answers1

0

Let the client redirect.

<%
  if(session.getAttribute("Login") == null){ %>
     <script>
         location.href = "../LOGME?name=" + yourValue;
     </script>
 <% return; // you should check the return ...
  } else {
    //draw page body
  } %>

Won't work on my machine though. I'm on Linux, so no f... ActiveX.

atmin
  • 370
  • 1
  • 7