a-shell
a-shell copied to clipboard
HTML preview
The html preview (with the view command) doesn’t show the canvas element, nor alerts.
<!doctype html>
<html lang='en'>
<body>
dodo
<canvas width='400' height='400'></canvas>
<div id='message'>Message Box</div>
<script>
alert('hello');
</script>
</body>
Indeed. This is iOS default HTML previewer, so I am not sure I can do anything about it.
There are two tools to run Javascript files directly (jsc
and jsi
, the former is a compiler that executes the entire file, the latter an interactive interpreter).
If you want to make a GUI with JavaScript, I suggest looking into jsi --in-window
and jsc --in-window
.
I've also used python3 -m http.server
to start a server that runs on http://localhost:8000/
. When I do this, I generally run the server in a-Shell Mini
and edit files in vim
via a-Shell
.
It's somewhat difficult to use, though, because iOS pauses the Python script soon after navigating away from a-Shell.