Solved

run window command on browser with javascript and its concept

Posted on 2014-07-27
9
391 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 108

Expert Comment

by:Ray Paseur
Comment Utility
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
Comment Utility
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 108

Expert Comment

by:Ray Paseur
Comment Utility
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
 
LVL 13

Author Comment

by:duncanb7
Comment Utility
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
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
Comment Utility
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 108

Accepted Solution

by:
Ray Paseur earned 500 total points
Comment Utility
...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
Comment Utility
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 108

Expert Comment

by:Ray Paseur
Comment Utility
Thanks for the points.  Glad the dialog was helpful!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now