Hi all, So i have been using Godot for a few days now and i like it. I am developing a web based app that allows the user to open file from the local file system. Since Godot does not support this, i though about using javascript to open the file and pass the contents to godot. This is what i have so far:
extends Control
func _on_Button_pressed():
var content = JavaScript.eval("""
var input = document.createElement('input');
input.type = 'file';
input.onchange = e => {
var file = e.target.files[0];
var reader = new FileReader();
reader.readAsText(file,'UTF-8');
reader.onload = readerEvent => {
var filecontent = readerEvent.target.result; // this is the content!
}
}
input.click();
""")
My problem is how to get the content from javascript back to godot.