e1s
e1s

Reputation: 375

Call LibreOffice Calc with JS

I'm looking for a way to call LibreOffice Calc from js script (for example open existing file on disk). I know that I can open Excel using ActiveXObject, but with Calc it not working.

<script type="text/javascript">
  function test() {
    var Excel = new ActiveXObject("Excel.Application");
    Excel.Visible = true;
    Excel.Workbooks.Open("teste.xlsx");
  }
</script>

update: first priority is IE

Upvotes: 0

Views: 1243

Answers (1)

Kurt Thiemann
Kurt Thiemann

Reputation: 344

You can't. (At least not in a standard browser)

For obvious security reasons, it is not possible to start native applications from JavaScript. Imagine if any website you visit could just randomly start programs on your computer.

ActiveXObject is an old feature of the Internet Explorer and will definitely not work in any modern browser (as the subtle warning on its MDN page indicates: https://developer.mozilla.org/en-US/docs/Archive/Web/JavaScript/Microsoft_Extensions/ActiveXObject).

Edit: here is an excellent article about the browser sandbox and why it is necessary: https://web.dev/browser-sandbox/

Upvotes: 1

Related Questions