Use cross domain images

Get help using Construct 2

Post » Tue Jan 28, 2014 7:33 pm

So I've read the documentation about sprites and ajax objects, but I'm still a little baffled on how to load an image to a sprite from a different domain.

Part of this bafflement is that if I write:

<img src="http://crispme.com/wp-content/uploads/88456.jpg?pass" alt="Smiley face" width="420" height="420">

In an html file in the same location as my construct 2 project, it works just fine, but if I try to load the image (http://crispme.com/wp-content/uploads/88456.jpg?pass) it doesn't work, nor does it come up with an error in the console log.

Does HTML have some way around this cross-domain permissions thing? But the more important question is how would I be able to load an image into my game cross-domain?
B
11
S
3
G
1
Posts: 98
Reputation: 1,062

Post » Tue Jan 28, 2014 8:56 pm

It's the same as with AJAX requests: use the Access-Control-Allow-Origin HTTP header.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Post » Tue Jan 28, 2014 9:30 pm

I got that it's the same as AJAX from reading the docs, but I'm not sure how to do it way AJAX either. Does that mean I need add it to the header in the exported .html file? *Tries it* Nope that didn't seem to do anything. *Reads link from AJAX documentation a little closer*
B
11
S
3
G
1
Posts: 98
Reputation: 1,062


Return to How do I....?

Who is online

Users browsing this forum: evillair, Fenix18 and 62 guests