Opening current URL from the XML (for Facebook etc.)

  • Is it possible to make something like this:


    Code
    <plugin name="facebook"
    url="facebook_logo.png"
    align="rightbottom"
    onhover="showtext(Add this to Facebook);"
    onclick="openurl('http://www.facebook.com/sharer.php?u='+location.href+'&amp;t='+document.title);"
    x="10"
    y="10"
    />

    That's not obviously working, but that's the idea: Opening the current URL so you could add that to Facebook etc. Can I call my own Javascript commands or use some variables that I pass via the SFW call etc?

  • I'm not sure what your question is... I have some ideas... but if you could try to clarify what you want to do and from where you are trying to do it we can help you better. *g*

    Do you want to make some type of "share this" link that works with facebook?
    - there's a commercial swf app that someone found on flashden that seems to work.

    Do you want to embed your pano in facebook?
    - I've used clearspring as well as the fb developer tools to do this

    Let us know.

    Graydon

  • Of course, there's one way to do it without altering the XML etc. by modifying your template and using for example 5% of the bottom space for links etc.

    But then you lose that 5% from the viewing space of the panorama and I don't want that. :)

    Second way would be making a redirect site: like http://www.example.com/facebook-redirector.php and there we can do like:

    PHP
    <?php
    header('Location: http://www.facebook.com/sharer.php?u='.urlencode($_SERVER['HTTP_REFERER']));
    ?>


    etc? (note: that's just an example, haven't tested it. :D

    Then you just make your button to the XML and open redirector url from the link? right?

  • That's not obviously working, but that's the idea: Opening the current URL so you could add that to Facebook etc. Can I call my own Javascript commands or use some variables that I pass via the SFW call etc?

    Hi,

    yes, both is possible,
    you could either make a javascript function and call it from krpano,

    e.g.
    XML:

    Code
    .. onclick="js( add_to_facebook() );"

    HTML/JS:

    Code
    function add_to_facebook()
    {
      window.location='http://www.facebook.com/sharer.php?u='+location.href+'&amp;t='+document.title;
    }


    or pass the full facebook url to krpano and open it from there,

    HTML/JS:

    Code
    so.addVariable("add_to_facebook_url", ....);

    XML: (krpano 1.0.8 beta 8 needed for this!)

    Code
    ... onclick="openurl( get(add_to_facebook_url) );"


    best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!