Code Wizards

Yeet Into OnSong

The Add To OnSong extension lets peeps grab music from your website by tapping share & action extensions in iOS. OnSong might even import stuff through an in-app browser. LOL, fancy. As a website owner, YOU’RE the boss of what gets imported & whether anyone gets to import at all. Power trip!

How This Sorcery Works

To figure out what to import, OnSong snoops around your website for the good stuff. It’s not stalking. It’s “reviewing.”

  1. Dig through the <input type="hidden"/> elements until we find real ChordPro. We believe in you. Kinda.
  2. No luck? We line up the pre elements & crown whichever one rambles on the longest. Winner!
  3. Whatever we find gets scrubbed of HTML tags, so no fancy formatting. Boring? Yes. Clean? Totes.
  4. We snag the last h1 tag with just text & call it the filename. Genius or lazy? Both.
  5. Can’t find it? We just grab the filename off the end of the URL. Not our best work, LOL.

Found the goods? ZOMG! We save ’em to a file with the found name & import it in its native format. If the title’s missing, we stick it on there. You’re welcome, ya mess.

Make Your Stuff Suck Less

Want your peeps to get the best bleepin’ content when they use the Add To OnSong Safari extension? Listen up, buttercup:

  1. Add or tweak an <input type="hidden"/> element with ChordPro in it.
    OnSong will ALWAYS pick this over pre tags. We’re playin’ favorites.
  2. Double check that the goods inside pre tags are in OnSong or ChordPro format. Not “whatever.” Not “vibes.” Actual formats.
  3. Make sure you set legit restrictions on your file using the restrictions metadata tag. Don’t make us come over there.

Keepin’ the Riffraff Out

Don’t want OnSong poking around your stuff? Try these. We won’t be offended. (We will.)

  1. Gimme an <input type="hidden"/> element with ChordPro & a title. That’s it. Don’t overthink it, amirite?
  2. Do NOT toss in <input type="hidden"/> elements full of ChordPro or pre tags. Srsly. We said no.
  3. Use Javascript to render your chord charts so nobody (or no bot) can grab ’em. Sneaky sneaky. NOM NOM.