2010
08.02

We’ve been delighted with the response to our new online radio player. Lots of sites have embedded our player on their pages, and it’s been a really successful rollout.

Late on Friday however, we got wind that one of the users of our embedded player had withdrawn it from their site because it caused an increase in their page load time. Now we should point out here that we’re not particularly special in this regard – the same problem affects all manner of webpage widget providers who employ the same mechanism to deliver their content. However, we at Radio Tuna weren’t happy that we had lost even one of our users as a result of this slow loading problem, so we decided to find a way around it.

What we’ve come up with was not simple to develop (if it was, there’d be a well-known fix out there already) and it took a very intensive Friday-night-thru-Saturday-morning coding session to create, but we do like a challenge at Tuna Towers and we’re pleased to say that within 24 hours we’d come up with a very nifty solution…

So What Causes the Problem?

In the default mode of running, the “create” page wizard generates two tags, one being a small item of markup (in our case an anchor tag) in the web page that serves as a placeholder that is replaced, and the second is a script tag that fetches a script from Radio Tuna’s servers to perform the transformation. From the browser’s point of view, it is unsafe to continue loading the rest of the page until the Javascript from Radio Tuna has been fetched and executed. Now consider the way our widget is used:

Current RadioTuna embed visual

So placing a script tag in the body of someone else’s content causes a delay in overall page load time of their page. For most users the delay is perfectly within expectations and not a problem, but others may well find the delay unacceptable.

The Solution

Instead of using an inline script that fetches content from RadioTuna.com, we’ve developed a totally new deployment method. This creates actual javascript code that does nothing more that wait until your document and all the images that it references are fully loaded. Only when this happens is a connection made to Radio Tuna’s servers, meaning that there is no dependency on RadioTuna.com that must be fulfilled before the bottom half of your page loads. Hey presto – our widget no longer affects your page load time.

New RadioTuna embed visual

As before the code is created in two tags, an anchor tag and a script tag. Although placed on a single line for convenience, it is perfectly safe to split up the anchor tag and script tag and move the script into the head of your webpage if you don’t like mixing content and logic together. Of course, because the anchor tag serves as a placeholder for the player, this must remain in the correct position in your web page.

Because this new delivery mechanism is currently still in beta phase (and because the javascript looks a little opaque), we are not rolling out the updated wizard as the default, but if you’re after absolute speed for your own web page you can find the updated wizard here:

http://radiotuna.com/OnlineRadioPlayer/create?deferred=true

If you have any questions or comments about the new embed code, please let us know.

13 comments so far

Add Your Comment
  1. my visitors on alilgplay.com still prefer the old version.. i mean MINI TUNA…!!!! why? probably because it have search box to find stations easier!
    anyways GOOD JOB!!!
    i wish this website stay online for more then 2020 :D

  2. perfect

  3. me gusta es muy bonito gracias

  4. nice

  5. Let me try it first

  6. That was simple.

  7. This is awsome. Thank you for your educations and hard work to put this together. I totally appreciate what you do to help make this world a better place to live. Keep it up.
    Carolyn

  8. This is a great add to my site. I am proud to show it to my visitors. I hope it will stay online for a long long time. Well done!

  9. i think its awsome i get to listen to all my country music i want i mean sugerland,carrie underwood,tim mcarraw,ect. i love it!!!

  10. Very very cool. Keep up the great work & thanks a bunch.

  11. Hey, Tuna team, thanks a bunch for this cool widget. I recently started blogging and it’s pretty cool have this feature on my blog. My only question is, is there a way to have the player automatically kick on when you access the blog? That would be much easier for the visitors instead of having to click play every time.
    Thanks,
    V

  12. I love it.

  13. I would use it on my 3 sites if you had Christian music.