Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have my website setting up the unity webapp integration on load. In contrast to Firefox, Chromium hasn't the API available immediately after loading the page.
Is there any best practice how to wait for the API to become available or should I just recheck after a couple of seconds?

share|improve this question
up vote 1 down vote accepted

The example below (from here) shows the event unity-webapps-api-ready will fire when the API is available. I'm not sure where this is officially documented, but it seems to work for me.

function onApiReady() {
    Unity = external.getUnityObject(1.0); 
    Unity.init({name: "Unity Web Tutorial",
        iconUrl: "",
        onInit: unityReady});

if ('Chromium') >= 0) {
    // Wait until WebApps API is available
    document.addEventListener('unity-webapps-api-ready', onApiReady);
} else {
share|improve this answer
Thank you! That was what I've been searching for. I haven't found any documentation on that. – MeinAccount Oct 28 '13 at 7:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.