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: 154
Reputation: 3,117

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
387
S
230
G
87
Posts: 24,249
Reputation: 192,240


Return to How do I....?

Who is online

Users browsing this forum: SturmIV and 4 guests