How to make audio autoplay on chrome

Solution #1 My solution here is to create an iframe <iframe src=”https://stackoverflow.com/questions/50490304/audio/source.mp3″ allow=”autoplay” style=”display:none” id=”iframeAudio”> </iframe> and audio tag aswell for non-chrome browsers <audio autoplay loop id=”playAudio”> <source src=”https://stackoverflow.com/questions/50490304/audio/source.mp3″> </audio> and in my script var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor); if (!isChrome){ $(‘#iframeAudio’).remove() } else { $(‘#playAudio’).remove() // just to make sure that it … Read more

How to access the webpage DOM rather than the extension page DOM?

Extension pages/scripts such as the browser_action popup or ManifestV2 background script have their own DOM, document, window, and a chrome-extension:// URL (use devtools for that part of the extension to inspect it). ManifestV3 service worker doesn’t have any DOM/document. You need a content script to access DOM of web pages and interact with a tab’s … Read more