HTML5 Speech recognition --- is there a way to set what the user is expected to say dynamically? (Using custom Grammars)
I found a way to do it client-side, using a new html5 feature: blobs.
window.URL = window.URL || window.webkitURL;
var myGrammar = new Blob(["My custom grammar"], {
type: 'text/xml Or whatever is the proper MIME type for grammars'});
var grammarUrl = window.URL.createObjectURL(myGrammar);
myInput = document.getElementById("myInput");
myInput.grammar = grammarUrl;
This makes a url out of the grammar string, and then sets that url for our input
element.
This way there is no need to make a server request, thus making it faster and less load on the server.
For more information on blobs, see this and this.
Grammar in Google Web Speech API
Correct answer is: no, you can't. =(
Related Topics
Background Video with 100% Width and Fixed Height
Why Is Box-Sizing Acting Different on Table Vs Div
Fixed Body Background Scrolls with The Page on iOS7
Adding Icon to Rails Application
Uiwebview with Contenteditable (HTML Editing), First Responder Handling
Overriding CSS Properties for a Specific HTML Element
Auto Resize Image in CSS Flexbox Layout and Keeping Aspect Ratio
Firefox Form Targeting an Iframe Is Opening New Tab
Chrome, Safari Ignoring Max-Width in Table
How to Make Bootstrap Carousel Image Responsive
Meta Viewport Just on Portrait
<Div> into a <Tr>: Is It Correct
How to Correctly Use "Scoped" Styles in Vuejs Single File Components
Gradient Stroke Along Curve in Canvas
Can a: :Before Selector Be Used with a <Textarea>
CSS Filter Not Working in Firefox