JavaScript SpeechSynthesis API

Date:

Share post:

As the web continues to be the medium for all users, standards bodies need to continue to provide new APIs to enrich user experience and accessibility. One underused API for unsighted users is speechSynthesis, an API to programmatically direct the browser to audibly speak any arbitrary string.

The Code

You can direct the browser to utter speech with window.speechSynthesis and SpeechSynthesisUtterance:

window.speechSynthesis.speak(
    new SpeechSynthesisUtterance('Hey Jude!')
)

speechSynthesis.speak will robotically tell the user anything you provide as a SpeechSynthesisUtterance string. Support for this API is available in all modern browsers.

I wouldn’t consider speechSynthesis as a replacement for native accessibility tools, but this API could be used to improve what native tools provide!

Request Metrics real user monitoring
Request Metrics real user monitoring
Request Metrics real user monitoring
  • CSS 3D Folding Animation
  • Detect DOM Node Insertions with JavaScript and CSS Animations
  • DWRequest: MooTools 1.2 AJAX Listener & Message Display

    DWRequest: MooTools 1.2 AJAX Listener & Message Display

    Though MooTools 1.2 is in its second beta stage, its basic syntax and theory changes have been hashed out. The JavaScript library continues to improve and become more flexible. Fellow DZone Zone Leader Boyan Kostadinov wrote a very useful article detailing how you can add a…

  • Styling CSS Print Page Breaks

    Styling CSS Print Page Breaks

    It’s important to construct your websites in a fashion that lends well to print. I use a page-break CSS class on my websites to tell the browser to insert a page break at strategic points on the page. During the development of my…


Source link
spot_img

Related articles

Kimwolf Botnet Swamps Anonymity Network I2P – Krebs on Security

For the past week, the massive “Internet of Things” (IoT) botnet known as Kimwolf has been disrupting The...

Why Spanish Job Fairs Are Going Digital And How Your Event Can Too

Across Spain, job fairs are undergoing a digital transformation and the results are undeniable. By embracing smart technology,...