HTML for listing the folder contents [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have html file which do button operations on specific events.
When i tried to execute a shell script from html , I am not able to do the same.
Please help me to run shell script inside html.
Thanks

HTML does not have this capability.
(Nor, for that matter, does core JavaScript. Extensions from the host environment might provide that feature, but it would depend on the host environment. "A webpage with a <script> element" is a host environment that does not provide that functionality.)
You need to select a different technology. It could be one that outputs HTML though.

At first, this is not a simple "I have a problem, solve it for me!" site. But since it's SO's goal to educate, it would be wrong to push you away.
Let's start with your problem:
HTML can't do that, nor vanilla JavaScript. If the server with the files on it does support PHP and you have access to it in order to store a .php file on it, you can do it by using PHP:
$directory = "some/directory/you/want/to/display/";
$files = scandir($directory);
print_r($files);

Related

simulate a server vs running the html file [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I recently started some web-design and when I look for tutorials on youtube I often see people, when checking their code, using some kind of virtual server to upload and then see their page. I was wondering what difference would there be to simply lunch the html file I'm working and see it through my browser? Does it really make a difference to use a local server? and if yes which ways would you recommend to achieve that?
Thanks!
If you just have pure html and css then opening the file in the browser is the exact same as opening it in a server. However, the real difference is with javascript. If you try to make an HTTP request using js to your own site, it will work on a server but will not work if you open it as a file. If you want to start a server, python has a SimpleHTTPServer module, and most code editors have some sort of plugin, like VS Live Server for VS Code.

How can I compile code recieved through a textarea element from a webpage? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am trying to execute the code written in a text area (using codemirror js)
<textarea id="editor" cols="100" rows="50"></textarea>
I want to execute this code on my Heroku server but I cannot compile it as it does not have GCC installed on it. Can I install GCC on my (Free tier) Heroku server? Is there a different way to do it? Any possible solution is welcome.
Well, you would need to decide on a backend to use.
You can get the textfields content in a number of ways, like sending it through the use of a html form to any recipient, like a php script
or send it via Javascript calls,
or any other way.
Then you'd probably want to sanitize the users input to make sure it's not malicious
then you need to write the piece of software that feeds the code to an interpreter, and wait for it's result
And then you will need a piece of software that will send those results back to the user.

Does writing JavaScript in <script></script> tags inside a PHP file make it more secure? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Suppose I have an MVC structure. Does writing JavaScript in script tags inside a PHP view file make the code more secured?
Will it still be seen by the client in source code?
Will there be any issues because of this?
I have tried calling an Ajax in a PHP view, but my teacher told me not to do it. I thought the only reason why she told me not to do it was the code not to get too mixed up and unreadable. Please tell me about this topic.
Your php will generate page with your script tag and send it to browser - so it is not more secure. However if you move your JS code into separate file and link it in your page, the code will be more readable and easier to develop in future.
Code executed in the client (browser, frontend, whatever) will always be accesible thus not "hidden" nor "secure".
Code executed in the server (backend) may not be visible to the client (this depends on how you structure your code, how much secure it its, etc.).

How to browse the client machine's logical drives, folders and subfolders in asp.net c# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
How to browse the client machine's file system. Since it is not possible through c#, I've been trying through various resources like javascript and using activex control. Can someone help me in working out with how to get it done using either javascript or activex control.
Requirement:
My requirement is something like, when the client logs in, the code should be able to browse through the clients file system (drives, folders and subfolders) when he wants to navigate through. I need to display the file system in the form of treeview.
Thanks in advance.
Did you tried FileUpload Control? Hope so it will work for you to some extent.
Apart from this, no javascript or server side code can perform this action.

How to create a new file in a folder using javascript [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am making a web application using javascript. I want to know
1) How can we create a new html file using javascript?
suppose I have a folder with locationexamples\new Files\. so I want that if some one click a button on my page then a javascript function runs and then creates a new html file in new Files folder with a specific text defined by the user.
Is there any way to do this or
Do i have to use different languages?
Javascript that is used in browsers, like jQuery, has no access to the filesystem. It is a security restriction, otherwise any tom dick or harry on the internet could seriously mess up your computer.
The only filesystem access allowed is Cookies.
If you want to achieve something like this, you will need something like node.js, although I have no experience with node.

Categories

Resources