<p>Drag following link to your favourites bar.</p>

<a href="javascript:(function()%7Bjavascript%3A(function()%20%7B%2F*%20Create%20query%20for%20all%20live%20region%20types%20*%2Fconst%20liveRegionQuery%20%3D%20document.querySelectorAll('%5Baria-live%3D%22polite%22%5D%2C%20%5Baria-live%3D%22assertive%22%5D%2C%20%5Brole%3D%22alert%22%5D%2C%20%5Brole%3D%22status%22%5D%2C%20%5Brole%3D%22log%22%5D%2C%20%5Brole%3D%22timer%22%5D%2C%20%5Brole%3D%22marquee%22%5D')%3B%2F*%20Array%20to%20store%20live%20region%20code%2C%20string%20to%20copy%20it%20to%20for%20displaying%20in%20new%20page%2C%20counter%20to%20counter%20number%20of%20regions%20*%2Fconst%20liveRegions%20%3D%20%5B%5D%3Bvar%20pageUrl%20%3D%20%22%22%3Bvar%20liveRegionOutput%20%3D%20%22%22%3Bvar%20liveRegionCount%20%3D%200%3B%2F*%20Get%20page%20URL%20*%2FpageUrl%20%3D%20window.location.href%3B%2F*%20Step%20through%20all%20elements%20in%20query%20nodelist%20*%2FliveRegionQuery.forEach(function(liveRegion)%20%7B%2F*%20Escape%20HTML%20chars%20with%20entity%20codes%20so%20string%20can%20be%20displayed%20as%20text%20*%2Flet%20liveRegionCode%20%3D%20liveRegion.outerHTML.replace(%2F%26%2Fg%2C%20%22%26amp%3B%22).replace(%2F%3C%2Fg%2C%20%22%26lt%3B%22).replace(%2F%3E%2Fg%2C%20%22%26gt%3B%3Cbr%3E%22).replace(%2F%22%2Fg%2C%20%22%26quot%3B%22).replace(%2F'%2Fg%2C%20%22%26%2339%3B%22)%3B%2F*%20Add%20%3Cmark%3E%20element%20around%20live%20attributes%20to%20make%20them%20easier%20to%20spot%20*%2FliveRegionCode%20%3D%20liveRegionCode.replace(%2Faria-live%3D%26quot%3Bpolite%26quot%3B%2Fg%2C%20%22%3Cmark%3Earia-live%3D%26quot%3Bpolite%26quot%3B%3C%2Fmark%3E%22).replace(%2Faria-live%3D%26quot%3Bassertive%26quot%3B%2Fg%2C%20%22%3Cmark%3Earia-live%3D%26quot%3Bassertive%26quot%3B%3C%2Fmark%3E%22).replace(%2Frole%3D%26quot%3Balert%26quot%3B%2Fg%2C%20%22%3Cmark%3Erole%3D%26quot%3Balert%26quot%3B%3C%2Fmark%3E%22).replace(%2Frole%3D%26quot%3Bstatus%26quot%3B%2Fg%2C%20%22%3Cmark%3Erole%3D%26quot%3Bstatus%26quot%3B%3C%2Fmark%3E%22).replace(%2Frole%3D%26quot%3Blog%26quot%3B%2Fg%2C%20%22%3Cmark%3Erole%3D%26quot%3Blogquot%3B%3C%2Fmark%3E%22).replace(%2Frole%3D%26quot%3Btimer%26quot%3B%2Fg%2C%20%22%3Cmark%3Erole%3D%26quot%3Btimer%26quot%3B%3C%2Fmark%3E%22).replace(%2Frole%3D%26quot%3Bmarquee%26quot%3B%2Fg%2C%20%22%3Cmark%3Erole%3D%26quot%3Bmarquee%26quot%3B%3C%2Fmark%3E%22)%3B%2F*%20Increment%20region%20counter%20*%2FliveRegionCount%2B%2B%3B%2F*%20Add%20live%20region%20outer%20html%20to%20array%20*%2FliveRegions.push(%60%3Ch2%3ELive%20region%3A%20%60%20%2B%20liveRegionCount%20%2B%20%60%3C%2Fh2%3E%3Cpre%3E%3Ccode%20class%3D%22language-markup%22%3E%60%20%2B%20liveRegionCode%20%2B%20%60%3C%2Fcode%3E%3C%2Fpre%3E%60)%3B%7D)%3BliveRegionOutput%20%3D%20liveRegions.join('%5Cr%5Cn')%3B%2F*%20Create%20new%20window%2Ftab%2C%20and%20output%20heading%20and%20live%20region%20list%20*%2Fvar%20myWin%20%3D%20window.open(%22My%20Window%22%2C%20%22_blank%22)%3BmyWin.document.write(%60%3Chtml%3E%3Chead%3E%3Ctitle%3ELive%20regions%3C%2Ftitle%3E%3Cstyle%3Ebody%20%7B%20font-family%3A%20verdana%3B%20%7D%20code%2C%20pre%20%7B%20font-family%3A%20%22courier%20new%22%3B%20%7D%20pre%20%7B%20margin%3A%201em%3B%20padding%3A%200.5em%3B%20border%3A%20solid%203px%20%23666%3B%20background-color%3A%20%23efe%3B%20overflow-wrap%3A%20break-all%3B%20white-space%3A%20pre-wrap%3B%20mark%20%7Bbackground-color%3A%20yellow%3B%7D%3C%2Fstyle%3E%3C%2Fhead%3E%3Cbody%3E%60)%3BmyWin.document.write(%60%3Ch1%3E%60%20%2B%20liveRegionCount%20%2B%20%60%20live%20regions%20found%3C%2Fh1%3E%60)%3BmyWin.document.write(%60%3Cp%3EOn%20%60%20%2B%20pageUrl%20%2B%20%60%3C%2Fp%3E%60)%3BmyWin.document.write(liveRegionOutput)%3BmyWin.document.write(%60%3C%2Fbody%3E%3C%2Fhtml%3E%60)%3B%7D)()%7D)()">List live regions</a>
* {
  font-family: verdana;
}
javascript:(function() {

  /* Create query for all live region types */
  const liveRegionQuery = document.querySelectorAll('[aria-live="polite"], [aria-live="assertive"], [role="alert"], [role="status"], [role="log"], [role="timer"], [role="marquee"]');

  /* Array to store live region code, string to copy it to for displaying in new page, counter to counter number of regions */
  const liveRegions = [];
  var pageUrl = "";
  var liveRegionOutput = "";
  var liveRegionCount = 0;
  
  /* Get page URL */
  pageUrl = window.location.href;

  /* Step through all elements in query nodelist */
  liveRegionQuery.forEach(function(liveRegion) {

    /* Escape HTML chars with entity codes so string can be displayed as text */
    let liveRegionCode = liveRegion.outerHTML.replace(/&/g, "&amp;")
         .replace(/</g, "&lt;")
         .replace(/>/g, "&gt;<br>")
         .replace(/"/g, "&quot;")
         .replace(/'/g, "&#39;");     
         
    /* Add <mark> element around live attributes to make them easier to spot */
    liveRegionCode = liveRegionCode.replace(/aria-live=&quot;polite&quot;/g, "<mark>aria-live=&quot;polite&quot;</mark>")
      .replace(/aria-live=&quot;assertive&quot;/g, "<mark>aria-live=&quot;assertive&quot;</mark>")
      .replace(/role=&quot;alert&quot;/g, "<mark>role=&quot;alert&quot;</mark>")
      .replace(/role=&quot;status&quot;/g, "<mark>role=&quot;status&quot;</mark>")
      .replace(/role=&quot;log&quot;/g, "<mark>role=&quot;logquot;</mark>")
      .replace(/role=&quot;timer&quot;/g, "<mark>role=&quot;timer&quot;</mark>")
      .replace(/role=&quot;marquee&quot;/g, "<mark>role=&quot;marquee&quot;</mark>");

    /* Increment region counter */
    liveRegionCount++;

    /* Add live region outer html to array */
    liveRegions.push(`<h2>Live region: ` + liveRegionCount + `</h2><pre><code class="language-markup">` + liveRegionCode + `</code></pre>`);
  });

  liveRegionOutput = liveRegions.join('\r\n'); 

  /* Create new window/tab, and output heading and live region list */
  var myWin = window.open("My Window", "_blank");
  myWin.document.write(`<html>
		<head>
		<title>Live regions</title>
		<style>body { font-family: verdana; } code, pre { font-family: "courier new"; } pre { margin: 1em; padding: 0.5em; border: solid 3px #666; background-color: #efe; overflow-wrap: break-all; white-space: pre-wrap; mark {background-color: yellow;}</style>
    </head>
    <body>`);
  myWin.document.write(`<h1>` + liveRegionCount + ` live regions found</h1>`);
  myWin.document.write(`<p>On ` + pageUrl + `</p>`);
  myWin.document.write(liveRegionOutput);
  myWin.document.write(`</body></html>`);

})();

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.