!7 p { if (isMainProgram()) serveHttpAndOpenBrowser(); } html { ret h3("Chrome Spracherkennungstest") + loadJQuery() + hdiv("Ergebnisse erscheinen hier", id := 'results, style := "margin: 10px") + hjavascript([[ try { var recognition = new webkitSpeechRecognition(); recognition.lang = "de-DE"; recognition.onresult = function(event) { var result = event.results[0]; var transcript = result[0].transcript; $("#results").html("Transcript: " + transcript); } $("#results").html("Bereit"); //recognition.start(); } catch (err) { $("#results").html("Falscher Browser"); } ]]) + tag('button, "Starte Erkennung", onclick := "recognition.start()", type := 'button); }