loading XML from another domain

  • I have my Krpano core files along with images and XML on one domain and I am calling those files from a different domain. But I can't get it to work. Keep getting the Fatal Error / loading or parsing xml.

    I know it's not the xml, because pano works if everything is on the same domain. Also if I just do a flash only version it works.

    Here is my basic setup, which is on DOMAIN_A:
    <script type="text/javascript" src="DOMAIN_B/swfkrpano.js"></script>
    <div id="krpanocontent"></div>
    <script type="text/javascript">
    var viewer = createPanoViewer({swf:"DOMAIN_B/PATH_TO_SWF",target:"krpanocontent",width:"970",height:"620"});
    viewer.useHTML5("whenpossible");
    viewer.addVariable("xml", "DOMAIN_B/PATH_TO_XML");
    viewer.embed();
    </script>

    any help would be appreciated,
    sean

  • https://krpano.com/docu/xml/#security

    Ok, link doesn't take you there directly but here it is.

    <security>
    Loads a cross-domain policy file from a location specified by the url parameter. By default the Flash Player looks for the policy file located in root of a domain with the filename crossdomain.xml on the server to which a data-loading request is being made. With the crossdomain.url setting the Flash Player can load a policy file from a arbitrary locations.
    For more Informations have a look at the Adobe site:
    http://www.adobe.com/devnet/article…_file_spec.html


    <security>
    <crossdomainxml url="http://.../crossdomain.xml" />
    <crossdomainxml url="..." />
    ...
    <allowdomain domain="http://www.other-domain.com" />
    <allowdomain domain="..." />
    ...
    </security>attribute name full variable name type default value
    crossdomainxml[...].url security.crossdomainxml[...].url String
    Path to the crossdomain.xml on the other server.
    attribute name full variable name type default value
    allowdomain[...].domain security.allowdomain[...].domain String
    Allow access to other domains (necessary for plugins that want access other domains). You can also specify the special domain "*" to allow access from all domains. Specifying "*" is the only way to allow access to nonlocal SWF files from local SWF files that have been published using Access Network Only for the Local Playback Security option in the Flash authoring tool.

    I hoe that is what you were looking for.

  • Isn't that specifically Flash related? I am trying to just use the HTML5 Viewer, no Flash.
    Anyways, I tried what you suggested it and it doesn't help...

    thanks though...

  • Hi,

    cross domain access is even more restricted in Javascript than in Flash,
    I'm not sure if there are solutions without proxy servers for this case...

    best regards,
    Klaus

    Hi Klaus,

    is there likely to be a solution to this on the Javascript/HTM5 viewer side? I've found that Apache mod_proxy isn't always available in shared hosting environments or other content delivery methods. My situation is that I have various panos in separate containers on a content delivery network so each pano gets a unique subdomain. I link panos via hotspots and use Loadpano() to jump to each. In the Flash viewer it works fine provided there is a crossdomain.xml in each container. Unfortunately it fails in the js viewer and there is no way of doing mod_proxy URL rewriting on the CDN.

    regards,
    Andrew

  • Using mod_proxy (or any other proxy method) would negate the effect of using a CDN in the first place, because it "pumps" all the content through the server the proxy is on. I think your only option is to store your scripts on the CDN as well.

  • Hi,

    Quote

    And, how to use proxy server with krpanoiphone?

    e.g. use a small php script on your own server that loads the file from the other server,
    so for the Javascript (krpano) itself it looks like loading a normal file from the same server,

    best regards,
    Klaus

  • I created the crossdomain.xml and upload to the domain. Work well.
    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
    <cross-domain-policy>
    <site-control permitted-cross-domain-policies="all"/>
    <allow-access-from domain="*" secure="false"/>
    <allow-http-request-headers-from domain="*" headers="*" secure="false"/>
    </cross-domain-policy>

    I get from this https://www.adobe.com/devnet-docs/ac…ec/xdomain.html.

Participate now!

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