You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Tourvista

Intermediate

  • "Tourvista" started this thread

Posts: 257

Location: Leicester UK

  • Send private message

1

Wednesday, May 21st 2014, 11:54am

[Solved] HTML5 tour hosted in a different domain, enable CORS, check headers, etc...

Help!

I've been trying during the last 2 hours to understand the HTML5 Cross-Origin thing, and now my brain hurts. Literally!

So this is my problem:
- There is a virtual tour hosted in my clients server: http://www.creare360.co.uk/virtual-tours…ets/scene1.html
- My client wants to embed that virtual tour in one of its clients website: http://www.chadwickscarpets.co.uk/
- Flash works, but the iPad version doesn't. It display this message:
"FATAL ERROR: http://www.creare360.co.uk/virtual-tours…/files/tour.xml - Loading failed! (0)"
- I understand that this error is because of the virtual tour is being requested from another domain outside of the domain the resource originated from.
- I also understand that a way to fix this is enabling CORS: http://www.html5rocks.com/en/tutorials/cors/

But I'm failing miserably is understand how to do this with Krpano.
I can't ask my client to enable CORS in his server, so the only option is enable CORS on the Client.

There some information in the excelent Krpano documentation, but I don't understand several things:

1- Where do I have to add the following code:

Source code

1
2
3
4
5
6
7
8
<security cors="">
    <crossdomainxml url="http://.../crossdomain.xml" />
    <crossdomainxml url="..." />
    ...
    <allowdomain domain="www.other-domain.com" />
    <allowdomain domain="..." />
    ...
</security>

Inside http://www.creare360.co.uk/virtual-tours…/files/tour.xml?

2- In my example, I think that piece of code should look like this:

Source code

1
2
3
<security cors="anonymous">
    <crossdomainxml url="http://www.creare360.co.uk/virtual-tours/crossdomain.xml" />
</security>

Is that right?

I've read in several Forum threads that I need to "check the headers are sent correctly from the server". What does it means?
I'm using Firefox + Live HTTP Headers Add-on. But there is too much information and I'm not sure what am I looking for.
Any way, is that relevant for my example? The tour images path are relative to %SWFPATH%

Please, any help will be highly appreciated!!!

This post has been edited 1 times, last edit by "Tourvista" (May 28th 2014, 4:26pm)


Tourvista

Intermediate

  • "Tourvista" started this thread

Posts: 257

Location: Leicester UK

  • Send private message

2

Wednesday, May 28th 2014, 2:06pm

Can anyone please help me or at least point me to the right direction?

Thanks

3

Wednesday, May 28th 2014, 2:24pm

Hi,

it's important that the external server is sending the 'CORS header' together with the files.
In the xml itself basically notthing need to be changed for HTML5, the crossdomain.xml is a Flashplayer specialty.

If your Web-server is an Apache-server, the easiest way to enable CORS would be to put a .htaccess named file with the following content into the folder of the files that should be accessible:

Source code

1
Header set Access-Control-Allow-Origin "*"


Best regards,
Klaus

Tourvista

Intermediate

  • "Tourvista" started this thread

Posts: 257

Location: Leicester UK

  • Send private message

4

Wednesday, May 28th 2014, 3:08pm

Thank you very much Klaus.

I'll contact to the client and ask if he's willing to change their server settings.

Cheers

5

Wednesday, May 28th 2014, 3:16pm

If the server is an Apache server - that 'change their server settings' would be basically just uploading a right .htaccess file...

Tourvista

Intermediate

  • "Tourvista" started this thread

Posts: 257

Location: Leicester UK

  • Send private message

6

Wednesday, May 28th 2014, 3:48pm

I've just found the following page to test if CORS are enabled

http://test-cors.org

I've tested my client's server, which is where the virtual tours are hosted.
It returns nothing, which means CORS aren't enabled.



On the other hand, http://krpano.com is OK



Is this correct?

Thanks!

7

Wednesday, May 28th 2014, 4:05pm

Try to enter the full url of a xml or image file on that test page.

Btw - big parts of the krpano page are not CORS enabled, I don't want to allow external access .

Best regards,
Klaus

Tourvista

Intermediate

  • "Tourvista" started this thread

Posts: 257

Location: Leicester UK

  • Send private message

8

Wednesday, May 28th 2014, 4:26pm

Wicked!

This is exactly what I needed!

Thank you very much!