How do I load inage from URL in preview mode?

0 favourites
  • 9 posts
  • I know the help says that my server must have cross domain stuff but it doesnt make sense because when I'm previewing my game I haven't even uploaded it to a server.

    Is it possible to preview without having to build and upload my game to a server? I want to just preview the downloaded images.

    Is this possible, or am I required to upload my project to an online server evertime I want to test it?


  • Is it a remote URL? If so, the cross-domain stuff applies.

    If it's a local URL, it's tricky since your game is not actually uploaded. Requesting something like "image.png" will send a request to "", and your image does not exist at that URL. Normally you can just use sprites and tiled backgrounds anyway, loading a local URL seems like an unusual thing to do when you can just embed it in the game.

  • Its preview mode..testing on my PC with no servers etc but I'm trying to pull images from >>https://www.someimage.png I'm not sure what applies.

  • That would be a cross-domain image then, so the usual CORS stuff applies.

  • Hi. The Desktop Build has it disabled, so you can use this to bypass the CORS policy.

  • Thanks. In the end I tried uploading to the server, but I still get the same issue:


    Error loading resource: TypeError: "NetworkError when attempting to fetch resource." c3runtime.js:157:683


    Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at (Reason: CORS header 'Access-Control-Allow-Origin' missing).


    I have no idea why because there is a .htaccess file in the root of my directory with:

    Header set Access-Control-Allow-Origin '"*"

    -Both my site and the request site are https:

    -I tried both in Firefox AND Chrome I have no clue as to what is happening. I've been trying all day in various ways to get this to work :(

    Any ideas?

    I want to get this working without any additional PHP.



  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The image on does not send an Access-Control-Allow-Origin header. So no, it's not correctly configured. You can check the headers it sends in the networking panel of browser dev tools.

  • So just to clarify. The Access control stuff ALSO has to be on the server that I wish to get the image from?

    So its completely out of my control really and I cant just download images from any random URL??

  • Yes. It is only used on the server responding, it doesn't apply anywhere else.

    This is an essential part of security on the web. For example, it prevents random websites obtaining your Facebook profile picture without your permission.

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