Cross domain and krpano Javascript interface

  • Hi,

    How to work with cross domains and the krpano javascript interface ?
    I've some problems with get()/set()/call() methods called from JS script of the main HTML page, when main HTML page is on server A -and- XML + ressources (tiles/images) on a server B.

    Is there a best practice to do something with cross domains ?

    Thanks.

  • Hi,

    the Same-origin policyof Javascript forbids a Javascript communication between different domains, but resources like xml or images files should be not affected from that. For the resources itself it's only important that the other server is sending the CORS header.

    How are the xml and the images related to the Javascript interface in your case?

    Best regards,
    Klaus

  • I'm currently doing some tests on 2 differents IP.

    For xml and tiles, I can display them.
    I've added a .htaccess into the data directory (tiles+images+xml) with

    Code
    Header set Access-Control-Allow-Origin *

    to enable html5 player compatibility.

    Code
    <security cors="">
    	<crossdomainxml url="http://192.168.1.201/crossdomain.xml" />
    	<allowdomain domain="*" />
    </security>

    tag is not suffisent for HTML5 player but must be enabled for the Flash player.

  • Hi,

    are you testing with Apache servers and were the headers sent correctly from the server? (the headers can be seen in the Firefox or Chrome developer tools).

    Additionally you could also try:
    <security cors="use-credentials" />

    In some cases it seems the default anonymous CORS requests (cors="") are not enough...

    Basically this should work of course - e.g. all panos on the page below are loading the tiles from external servers:
    https://krpano.com/html5multires/

    Best regards,
    Klaus

Jetzt mitmachen!

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