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: 161
Reputation: 3,131

Post » Tue Sep 23, 2014 9:15 pm

yeah any help please? :)
B
37
S
9
G
8
Posts: 541
Reputation: 8,554

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
397
S
236
G
88
Posts: 24,423
Reputation: 194,560


Return to How do I....?

Who is online

Users browsing this forum: dop2000, hrisnz and 11 guests