Cant call bash script when testing through "run exported html in systems default browser"

Godot Version



So, I want to export my project to web (html5) and im trying to call some external function in my godot class like this:

	var output = []
	var exit_code = OS.execute(
		["-la" , "./"],

And it’s workin, when im testin using play scene btn in godot, But, Im gettin this error in browser console when testin my export inside godot (button run exported html in systems default browser):

ERROR: OS::execute() must be implemented in Javascript via 'engine.setOnExecute' if required. tmp_js_export.js:369:18 at: execute (platform/javascript/os_javascript.cpp:988) - Condition "failed" is true. Returned: ERR_UNAVAILABLE

can someone help, plz?

You won’t be able to access the terminal or launch any program from an html5 page. This is not a Godot issue, this is a security measure the browsers implement.


Ok, I see, but why? I want to execute those code only on my own server to do somethin on my server, I dont want to execute it on any user’s machines. So what’s the problem to do it server-side?

It wouldn’t run on the server though, that’d require something else, the code is all run client side

1 Like

To do things server side you’d probably benefit from using networking with it, and set up a “proper” server, the web server hosting the game won’t run code, the server could then run using either rpc calls or some other method, but it’s a whole complex thing to design and write and depends on what you need and want, you could write it in Godot or some separate system and use network packets to communicate, for example via websocket

1 Like