run window command on browser with javascript and its concept

Dear Experts,
one day, I found one updated javascript application code  embedded into the webpage I access daily and my apache server php coding could not collect the data information becoz  the code is written in javascript, it mean only allow client collect in browser to collect the data. Finally, I solved it by node.js installed in my apached sever and using php command of exec("node myjavscript.js")

-First question is brower can run javascript code if javascript is enabled on browser that is
NOT depended  on linux or window system , Right ? In other words, javascript running is
Not related to computer system architecture.

-Seoncd ,node.js installed in my server act as javascript complier similar to the action to C complier.Besides that, I don't find any special on node.js since a lot feaures which can be done on php coding on server and javascript on client. And for http access, we can have apache server instead of node.js run-time background process .  Any advise about this subject.

-Finally, When I try to think about " run window command on my browse at client side or home computerr", I don't know how node.js will assist on this from his child_process module. Any comment on this? My this  topic question is similar to ask how flash running into browser when flash run-time is installed on our window computer.

Please advise

Duncan
LVL 13
duncanb7Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
I'm not sure I can answer all of the questions here, but I might be able to give you a head-start.  Before you do anything else, please read this article:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/A_11271-Understanding-Client-Server-Protocols-and-Web-Applications.html

JavaScript is a client-side technology.  The JavaScript statements are prepared on the server and sent to the browser, in response to an HTTP request. Then the server disconnects.  So from the client perspective, the server software does not matter -- as long as valid JavaScript was sent to the client, the client is capable of running it.

Node.JS bends this design a bit by implementing a server-side programming language that looks much like the client-side javaScript language.  Node is an event machine for routing many concurrent requests on the server.  Think of it as if it were Python or Ruby on Rails.  It's not a part of the LAMP stack.

Things like this: "one day, I found one updated javascript application code embedded into the webpage..." usually mean your scripts were hacked.  Unless you changed the webpage code, you should find the same thing every day, and when things appear (surprise!) without your direct knowledge and action, you may want to review your security procedures.
0
duncanb7Author Commented:
Thanks for reply and article. And before this post, just think node.js is javascript complier  to compiler javascript code at server side, and ask myself  why my node.js will have  http access module feature if server has http access feature already.  After thinking around , the node.js might be useful for data communcation between  shell application and browser through http  or process access and based on javascript coding. it is similar or  sort of the way for adobe flash communcation between flash runtime process (installed on our window) and  browser.

For run command on browser, ActiveXObject is useful only on IE and but need to users to set all browser enable setting and that is NOT allowed on other browsers except using  its additional  add-on


Duncan
0
Ray PaseurCommented:
I think your analogy about Flash is quite apt.
ActiveXObject is useful only on IE
Right.  jQuery AJAX gives us cross-browser support.  This article illustrates the "hello world."
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/A_10712-The-Hello-World-Exercise-with-jQuery-and-PHP.html
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

duncanb7Author Commented:
jquery.ajax is communcation between  server and client browser. How is it related to "run window command on browser on the same computer " ? Could you advise more ?

Duncan
0
Ray PaseurCommented:
I may be misunderstanding the question.  Is there a client/server relationship between the browser and the windows computer?  It's not uncommon for us to set up a web server on a laptop, develop PHP scripts on the laptop and test them via the locally-installed web server.  There is no internet connection involved, but the protocols are still the same.
0
duncanb7Author Commented:
Ray, thanks for your reply and reveiw
My question is  posted previously with title of  "run window command on browser with javascript and its concept" and with the three questions.

I have done one node.js testing in mins ago  where node.js is running on my command cmd.exe shell in which it will listen port 8000 for http request and then run notepad.exe (window command or application)  if http request is triggered, and I go to type my computer IP with port 8000  on browse at the same computer , the notepad.exe is triggered on the same computer. That is what I want to know, and the  answer to this thread YES, if we can install node.js on the same computer as browser. In other words, we can trigger window command execution through client-side ajax.

The testing  is similar to    Java and flash run-time installed  on our client computer which can make communication between window system and browser so that we can run java or flash application on browser.

You agree it  ?

In other method, I can convert node.js as window object library and let browser to call for window and browser communication

Please advise

Duncan
0
Ray PaseurCommented:
...similar to Java and flash run-time installed on our client computer which can make communication between window system and browser so that we can run java or flash application on browser.
It sounds quite feasible.  I have never used these technologies, but I know that they exist.  I've never relied on them because I've heard people express concern about security issues.  But security would not be a concern if you were the one in control of the application from end-to-end on your own machine.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
duncanb7Author Commented:
Although, the answer is not exactly to my question answer . But it triggered me to think again server and client role and jquery.ajax role, and  so that I  think server and client  could be on the same computer not just on different computers

thanks for your replies

Duncan
0
Ray PaseurCommented:
Thanks for the points.  Glad the dialog was helpful!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.