-2

Javascript is inaccurate, but I need a very precise answers to a quartic equation. I want to slove it with c++, that i compiled into an exe file and will update the answers in a javascript file that I include in the HTML. I need to run the exe file that is in the same folder as the .html file on the server, and pass 5 parameters to it. It will update the javascript file, but I have no idea how to run that exe file. Can anyone help me?

----EDIT----

Thanks @Quentin webassembly worked!

  • Does this answer your question? [How to execute shell command in Javascript](https://stackoverflow.com/questions/1880198/how-to-execute-shell-command-in-javascript) – Richard Critten Sep 07 '22 at 17:54
  • Have you tried using a more accurate JS library for floats/integers instead of using C++? https://github.com/royNiladri/js-big-decimal – JRose Sep 07 '22 at 17:56
  • Consider [Webassembly](https://developer.mozilla.org/en-US/docs/WebAssembly) if you need high performance number crunching. – Quentin Sep 07 '22 at 17:57
  • The description of the overall process seems vaguely cobbled together without much understanding of web applications in general. Are you looking for end users to execute your application on their machines? Or would they trigger it to be executed on your server and they see the results? Or are you not serving end users at all and this is all for personal (local) use? Something else? It's not really clear to me what your overall UX goals are. – David Sep 07 '22 at 17:59

1 Answers1

1

You can't. That would be a severe security vulnerability, if any random web page could execute any random file on your computer.

So, web pages can't execute files on your computer.

user253751
  • 57,427
  • 7
  • 48
  • 90
  • I want to execute a file on the HOST machine, the server. – Ágoston Kis Sep 08 '22 at 08:43
  • @ÁgostonKis Ah, then it depends on the web server software. Web servers are allowed to do whatever they want, but you have to set them up to do what you want. Which server software do you use? – user253751 Sep 08 '22 at 14:17