Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run another program from HTML

I have the following snippet of the code:

<html>

<head>
<title>Example of Very First PHP Script ever!</title>
</head>

<body>
<script>
function comexe(){
C:\Program Files\Notepad++\notepad++.exe C:\Documents and Settings\User\Desktop\file.txt
}
</script>

<a href="return false;" onclick="comexe()">music</a>

</body>
</html>

How can I run another program from the HTML? What am I doing wrong?

like image 279
geek Avatar asked Jul 06 '26 00:07

geek


1 Answers

Adding this as an answer, as requested in the comments

You can't - HTML is client side, and javascript is sandboxed to protect the client PC from exactly this. Apart from the title, your script has nothing to do with PHP - which can run a filesystem command, but only on the server.

like image 185
Adam Hopkinson Avatar answered Jul 09 '26 02:07

Adam Hopkinson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!