Use cross domain images

  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's the same as with AJAX requests: use the Access-Control-Allow-Origin HTTP header.

  • 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*

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)