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
  • 9 More Mind-Blowing WebGL Demos
  • 6 Things You Didn’t Know About Firefox OS

    6 Things You Didn’t Know About Firefox OS

    Firefox OS is all over the tech news and for good reason:  Mozilla’s finally given web developers the platform that they need to create apps the way they’ve been creating them for years — with CSS, HTML, and JavaScript.  Firefox OS has been rapidly improving…

  • Send Email Notifications for Broken Images Using jQuery AJAX

    Send Email Notifications for Broken Images Using jQuery AJAX

    It’s usually best to repair broken image paths as soon as possible because they can damage a website’s credibility. And even worse is having a user tell you about it. Using jQuery and PHP, you can have your page automatically notify you of broken…

  • Animated AJAX Record Deletion Using Dojo

    Animated AJAX Record Deletion Using Dojo

    I’m a huge fan of WordPress’ method of individual article deletion. You click the delete link, the menu item animates red, and the item disappears. Here’s how to achieve that functionality with Dojo JavaScript. The PHP – Content & Header The following snippet goes at the…


Source link
spot_img

Related articles

Troy Hunt: Weekly Update 486

I’m in Oslo! Flighty is telling...

ASUS TUF Gaming Z790-Plus WiFi Motherboard Review

Key FeaturesPCIe 5.0 SupportDDR5 Compatible4x M.2 Slots16+1 DrMOSWiFi 6 EnabledThunderbolt 4 PortPros & ConsProsHigh RAM CapacityRobust Heat SpreadersMultiple...

Trans-World Events Transforms Event Ops into Strategic Growth Engine with Eventflow

Trans-World Events, the independent B2B exhibition organiser, has committed to a long-term partnership with exhibitor manual...