Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

run window command on browser with javascript and its concept

Posted on 2014-07-27
9
401 Views
Last Modified: 2014-07-28
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
0
Comment
Question by:duncanb7
  • 5
  • 4
9 Comments
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 40223771
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
 
LVL 13

Author Comment

by:duncanb7
ID: 40223805
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
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 40223820
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 13

Author Comment

by:duncanb7
ID: 40223857
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
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 40223995
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
 
LVL 13

Author Comment

by:duncanb7
ID: 40224057
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
 
LVL 109

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 40224189
...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
 
LVL 13

Author Closing Comment

by:duncanb7
ID: 40224208
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
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 40224218
Thanks for the points.  Glad the dialog was helpful!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

790 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