Playing music in your visitors Spotify using Safari
Well well, another post about safari! The problem I will take up today is the how Safari handles protocol handlers. In all other major browsers, even Internet Explorer, you have to agree to visit a link with a custom protocol. But not in safari. Oh no.
Luckily, programs usually has built in confirmation that will ask you if you really wish to do what the browser is trying to do... But not Spotify. Oh no. You can't favorite songs, add playlists or so. But you can play a song! Believe it or not, this code will start to play a song in Spotify in both Windows and Mac OS:
<script>
document.location = 'spotify:track:0QwzCPyTv6UnzjAhZZ0CkB';
</script>
It will start to play "Firestarter" by Prodigy. While we shouldn't overlook the seriousness in this matter, it could work as a pretty fun prank, playing a song when someone visits your site and make them think "I hate websites with music", they close the tab but the music continues, they close the browser and the music continues! Creepy stuff.
I have another post coming up regarding protocol handlers but meanwhile, have fun with this little Safari/Spotify trick
Ciao.

Sup, I'm Mathias and I was born 1991. It feels like I should really write something here.