Javascript Interface "krpano" not defined

  • I'm finding a few different ways to do this in the documentation and it's a bit confusing. What is the correct way to make the global krpano variables available via the JavaScript Interface for HTML5 on mobile devices?

    I am able to successfully use this for desktop and it works fine:

    Code
    krpano = document.getElementById("krpanoSWFObject").get("global");

    Obviously that doesn't work on mobile devices because the krpanoSWFObject does not exist. However, when I follow the instructions here to make it work for HTML5, I get an error in the console that krpano is not defined - even though I am defining it with an onready callback function in the embedpano script.

    Code
    krpano = krpano.get("global"); // -- is always undefined!

    Could anyone give me a little guidance on how this is supposed to work?

    Edited once, last by 360labs (July 24, 2024 at 8:59 PM).

  • Quote

    Obviously that doesn't work on mobile devices because the krpanoSWFObject does not exist.

    that is not true at all. it works the same on mobile and desktop.

    maybe you should evaluate your error:

    Code
    krpano = document.getElementById("krpanoSWFObject");
    console.log(krpano); // shouldn't be undefined!
    krpano = krpano.get("global");
    console.log(krpano);

    or

    Code
    embedpano({ ..., onready: function(krpano) {
        krpano = krpano.get("global");
    	console.log(krpano);
    });

    take care:

    if you have set id: "..." in your embedpano() call, then this will replace "krpanoSWFObject"

  • Oh, ok! I was under the impression after reading the docs that the SWFObject method would not work on mobile devices, and assumed that's what my problem was when my krpano calls for loadpano were not working on an Android device. Could be an entirely different problem like layer order, I'll dive into it.

  • Good to know, thanks! The problem I'm having is that an onclick inside of HTML in a data element is not working at all on Android devices (haven't tried iOS). They seem to do nothing at all, so I thought perhaps the krpano calls were not working when using krpano.actions.loadscene. They work fine on desktop. Now that I finally got debugging working on my phone, the console shows me that krpano is defined, but there's no error happening when I tap the onclick links. So I'm kinda stumped.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!