How do I enable cross-origin resource sharing for images?

Get help using Construct 2

Post » Thu Aug 21, 2014 4:03 pm

I have a server where I keep my PHP scripts and images. At first I had a problem because AJAX requests returned nothing: turned out that cross-origin sharing needed to be set up in the .htaccess file.

However, when I'm trying to load an image via 'Load image from URL' it still gives me this:
(...) has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I'm confused. How would I add this header specifically to an image file?
B
16
S
7
G
1
Posts: 167
Reputation: 3,163

Post » Tue Sep 23, 2014 9:15 pm

yeah any help please? :)
B
38
S
10
G
9
Posts: 542
Reputation: 9,181

Post » Tue Sep 23, 2014 9:27 pm

It depends on the server. In theory it's the same as you did for the AJAX requests. The images need to be sent with the Access-Control-Allow-Origin: * HTTP header as well.
Scirra Founder
B
414
S
245
G
92
Posts: 25,197
Reputation: 200,325


Return to How do I....?

Who is online

Users browsing this forum: Cassianno, Google [Bot], kelany and 3 guests