I know that we can read a file using filesystem api, Im doing something like this :
test.html file
<input type="file" onchange="readText(event)" />
<pre id="output"></pre>
<script>
async function readText(event) {
const file = event.target.files.item(0)
const text = await file.text();
document.getElementById("output").innerText = text
}
</script>
So now what I want to do, it's to read by defaut the same file (test.html) and don't need to choose the file.
The different step :
- I open a browser
- then test.html file
- display me the content of same file without click on choose file
How can I do that ?
Thanks for your help :)