js(fb.start) support for ipad

  • I've started moving to floatbox vs. greybox as it gives more functional ability. Problem is that I get the same issue with both when I change my user agent on my safari - iMac to Mobile Safari - 3.2.2.

    I am calling the floatbox via
    js(fb.start(client_xml/object_vr/image74.html)). This works in FireFox
    3.6.12 - sort of and Safari 5.0.3.

    When I switch
    my Safari user agent to Mobile Safari 3.2.2 and run the same onclick
    statement I get the following errors in my pano1.js file.

    Quote

    krpano embedding error: there is already a html element with this id: krpanoSWFObject pano1.js:48
    &
    TypeError: Result of expression 'J[a[_[106]]]' [undefined] is not an object. pano1.js:48

    My HTML looks like this.

    My Flash xml looks like this:

    My iPad xml looks like this and won't work with an action:

    Code
    <hotspot name="spot1" style="hotspot_ani_white" 
    		     	ath="167"
    		     	atv="17"
    		     	zoom="false"
    		     	onclick="js(fb.start(client_xml/object_vr/image74.html));"
    		     	/>

    It doesn't matter if it is html or an image I get the errors.

    Hope someone can help. you can see it at http://www.eyecandyvi.com/tb/fb_mobile.html. Pan to the left and follow the feet to the next pano. Pan again to the left and you'll see the pulsing icon.

    Robert

    Edited once, last by rbudnikas (November 30, 2010 at 7:16 PM).

  • Hi,

    at the moment only normal globally defined javascript functions can be called,
    but for the next release I have added an 'eval' fallback code when direct calling
    is not possible, then your code will work, but it will be slower then a direct function call,

    best regards,
    Klaus

  • So...i don'tt really understand what rbudnikas is trying to achieve, but i think this post gets near the problem i'm facing right now.
    And since i didn't want to start a new tread for something probably pretty easy to solve, i'm posting it here.

    I have to find a way, to call a link from the onclick-function a hotspot gives me. The 'loadPano' seems to not really load a new Website (hence i can't get back within the browser history...). So i tried to just load http://www.google.de when clicking some hotspot...to no success as one might imagine when reading this.
    To me this comes not unexpected, because JS and me are very similar to oil and water *tongue* .

    So here is what i already tried:

    Code
    <hotspot url="Hotspot.png" devices="all" ath="0.0" atv="0.0" onclick="js(loadGoogle());" />


    with the following in my main.html (the one wich is loading krPano)

    Code
    <script type="text/javascript">
    	function loadGoogle() {
    		window.location.href="http://www.google.de";
    	}
    </script>


    I've tried all i could think of...first calling an action that is then calling the above script...
    No script at all, just calling js direct after the onclick-funktion:

    Code
    <hotspot url="Hotspot.png" devices="all" ath="290.0" atv="0.0" onclick="javascript:window.location.href='http://www.google.de';" />


    (Even screaming and kicking at this son-of-a-... MAC i'm working on, didn't do the trick!!! Normally it does...really *g* )

    Within a normal browser this does what it is supposed to do...showing google.

    But since Klaus wrote: "at the moment only normal globally defined javascript functions can be called" there should be a way to do this...???

  • Ha!!! Got it!

    Not with using JS but with the openurl-funktion.
    Here we go:

    Code
    <hotspot url="Hotspot.png" devices="all" ath="0.0" atv="0.0" onclick="openurl(http://www.google.de);" />


    The odd part is, that the documentation says:
    "Note - this action requires the External Interface of the Flashplayer!" - So...iPad...FlashPlayer...??? Hell, whatever! It seems to work. *g*

  • Hi,

    onclick="javascript:window.location.href='http://www.google.de';"

    this doesn't work because you are using javascript syntax here
    in krpano there is only the js() action which can call javascript functions,
    e.g. it should look so:

    Code
    onclick="js( loadGoogle() );"

    but for the next release I have added an 'eval' fallback code when direct calling
    is not possible, then your code will work, but it will be slower then a direct function call,

    just as note - here with the release of the soundinterface plugin for the krpanoJS viewer,
    an updated krpanoJS viewer with that fix is included,

    best regards,
    Klaus

  • Hi,

    If I understand you correctly my code should now work.

    yes, it should work now,


    How do you implement the 'eval' fallback code.

    first I'm trying to call a given function directly, this is only possible when the javascript function is defined at global (=window object) scope, this is the 'fast' mode, but when that doesn't work I'm paring a function call string and execute that with the eval() function, this is slower but should work in any case,
    but finally you shouldn't care about that internal implementation until you have performance problems with it, maybe at 500-1000 js() calls per second or so...

    best regards,
    Klaus

  • Hi,

    <script type="text/JavaScript">
    eval(js(fb.start(http://www.domain.com))
    </script>

    What would the onclick look like?

    sorry, but your code doesn't make much sense,

    either do in the xml just:

    Code
    onclick="js(fb.start(http://www.domain.com));"

    or do - in the xml:

    Code
    onclick="js( fbcall() );"

    and in the html:

    Code
    <script>
      function fbcall()
      {
    	fb.start(http://www.domain.com);
      }
    </script>

    best regards,
    Klaus

  • Hi Klaus, this goes back to the time that I was trying to implement a floatbox and was getting an error on the ipad, fb.start could not be found.

    Using this onclick="js(fb.start(http://www.domain.com));" produces this error.

    You said the workaround was to use eval. I'll try this and let you know if what you wrote works.

    Thanks,

    Robert

    Update: Works! thanks again

    Edited once, last by rbudnikas (February 23, 2011 at 6:16 PM).

Participate now!

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