Using Nekoweb to add music for your website
Visit this page and check its source code. Go ahead! To view the source code you can use Ctrl+U. You'll see something similar to the MelonKing's autoplay is diabled popup.
You can use small HTML players inside an iFrame on a hosts that support MP3s to bypass Neocities restriction for free sites about external assets and restricted file types. This works, because Nekoweb is an alternative for Neocities that supports just that and does not set restrictive Access-Control and Content-Security-Policy headers.
So in order to make it work, just copy my code from view-source:https://gorciu.nekoweb.org/music and iFrame it in your website. It's best to use fixed position. You'll quickly see that it does not hide anything, even if you click Play it anyways. That's because you have to set an event listener message and check if the first argument dot action is equal to music-playing. If it is, use inline CSS to hide the element.
That's a shady tutorial, could you explain how it works?
In the playlist variable you can put your own songs you wanna to play. And if that's not enough for you, I can explain everything in the code.We have two functions - getRandomIndex, which gets the random song and playTrack which is executed every time a track stops. If the music is playing, it broadcats a message to your website, so you can hide the iFrame.
Never delete the element. It will stop the playback.
Instead, set opacity to zero, visibility to hidden or display to none (best solution).