Current location - Music Encyclopedia - QQ Music - How to write code in HTML to play music automatically?
How to write code in HTML to play music automatically?
due to the security policy of the browser, it is no longer supported to play music automatically when you open the page. If you need to play it, you need to let the user click on it. You can use the audio tag of html5 to load music for playing.

< audio src="https://lanye.org/demo.mp3" controls width="1%"> < /audio>