a-shell icon indicating copy to clipboard operation
a-shell copied to clipboard

HTML preview

Open netvogel opened this issue 2 years ago • 3 comments

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>

netvogel avatar Nov 08 '21 09:11 netvogel

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).

holzschu avatar Nov 08 '21 12:11 holzschu

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.