• Hi all,

    I have a tour set up on 'https://domain1.com/tour' but my pano assets are stored on 'https://domain2.com/panos/xyz123/...'. I have seen in some of the examples there are options to use different assets if the tour is accessed via different domains. e.g from 1 domain it uses 'x' assets and if not it uses 'y' assets.
    ie in the Wine Cellar example

    Code
    <image>
        <cube url="panos/mitte.tiles/pano_%s.jpg" if="browser.domain != 'krpano.com'" />
        <cube url="https://krpano.com/tours/bkeller/panos/bkeller2010-mitte.tiles/pano_%s.jpg" if="browser.domain == 'krpano.com'" />
    </image>

    What would I need to put in my tour.xml to use different assets if the link I send out to a client (https://domain1.com/tour) is used in an iframe on https://domain3.com? Ideally, I'd like to block it from being used in an iframe but the .htaccess lines (on both domain1 and domain2) I have used aren't working.

    Thanks

  • My way to solve this is that one:

    In index.hml(or where you have the embedpano() )

    In var 'direction' you ask if location is diferent to parent.location. If so, it means that the tour is inside an iframe, so you give it the route for iframes. Other ways you give it the route for the non iframe.

    In the embedpano(), inside initvars you create a variable (BASEDIRPANOS) and give it the value of 'the var 'direction'

    in tour.xml you have to repalace the normal 'panos/' with this initvar like this: %$BASEDIRPANOS%

    And that's it!
    If you want to block all the content, use the same logic with the whole krpano embedpano({...}) with an if function.

    Zitat

    if ( window.location === window.parent.location) {
    embedpano({
    ....
    })
    }


    * i don't know if this is a crossbrwoser solution

  • Hi,

    there are multiple ways, but if just blocking is your intention, then you could also just use the protect tool - it has this option:

    Zitat

    [x] Block viewer embedding into external (cross-domain) iframe


    When enabled, embedding into other domains will not work and shown an error.

    Best regards,
    Klaus

  • Hi both,

    Thanks very much for the 2 options.
    After speaking with my MD we've gone with the outright block (Klaus' option). Difficult client *wink*

    Handy to know noupunt's method for future reference.

    Thanks again

Jetzt mitmachen!

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