# Can't load images

**URL:** <https://phaser.discourse.group/t/cant-load-images/5924>\
**Category:** Phaser 3\
**Created:** [April 16, 2020, 11:35am UTC](https://phaser.discourse.group/t/cant-load-images/5924 "2020-04-16T11:35:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rubek](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@Rubek](https://phaser.discourse.group/u/Rubek)\
**Post date:** [April 16, 2020, 11:35am UTC](https://phaser.discourse.group/t/cant-load-images/5924/1 "2020-04-16T11:35:35Z")

</div>

I can’t load images for my phaser game? This is the problem I am trying to solve but I don’t know whatt now what mistake I have done.

This is my index.html code,

![Screenshot_1](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/3/30764a3589b5d862b25b514a98b94289014c5689.png)

And this is game.js code,

```
function preload() {
this.load.image('plant', 'plant.png');
}
function create() {
this.add.image(50,50, 'plant');
}
function update() {
}
const config = {
type: Phaser.AUTO,
height: 600,
width: 600,
background: 0x123456,
scene: {
    preload: preload,
    create: create,
    update: update,
}
}
const game = new Phaser.Game(config);

```

The google console says, _ **"Access to XMLHttpRequest at ‘file:///C:/wamp64/www/rungame/plant.png’ from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https."** _

Also, there are other two messages by the console,

 ![Screenshot_3](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/7/7013684c7ec84f80bedec94c9345d055748f51ef.png)

What wrong did I do? Please help

---

<div class="post-metadata">

**Author:** ![Nemesis](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@Nemesis](https://phaser.discourse.group/u/Nemesis)\
**Post date:** [April 16, 2020, 12:04pm UTC](https://phaser.discourse.group/t/cant-load-images/5924/2 "2020-04-16T12:04:03Z")

</div>

Are you running your game on a local web server?  
It seems the browse is blocking Cross-Origin requests. You need to be on `https://` for loading files from your device’s storage.

---

<div class="post-metadata">

**Author:** ![Rubek](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@Rubek](https://phaser.discourse.group/u/Rubek)\
**Post date:** [April 16, 2020, 12:21pm UTC](https://phaser.discourse.group/t/cant-load-images/5924/3 "2020-04-16T12:21:38Z")

</div>

Thanks, yes it works. But, instead of https, i have http, does it matter.  
And why images weren’t loading without local webserver?

---

<div class="post-metadata">

**Author:** ![Nemesis](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@Nemesis](https://phaser.discourse.group/u/Nemesis)\
**Post date:** [April 16, 2020, 1:40pm UTC](https://phaser.discourse.group/t/cant-load-images/5924/4 "2020-04-16T13:40:58Z")

</div>

The main difference between `http` and `https` is that in `https`, the data is encrypted and then transferred. So, it might not affect the game, but if you want to make transactions or handle sensitive information , then `https` is preferred.  
And the images were not loading without local webserver because of security reasons. Otherwise any javaScript file will be able to read and write on you device.

---

<div class="post-metadata">

**Author:** ![Telinc1](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/telinc1/32/60_2.png) [@Telinc1](https://phaser.discourse.group/u/Telinc1)\
**Post date:** [April 16, 2020, 2:25pm UTC](https://phaser.discourse.group/t/cant-load-images/5924/5 "2020-04-16T14:25:02Z")

</div>

[The first part of the Getting Started tutorial](http://phaser.io/tutorials/getting-started-phaser3) explains this.

For local development, it really shouldn’t matter whether you’re using HTTP or HTTPS. However, HTTPS is sometimes more restrictive and online hosts will almost certainly serve your game over HTTPS, so it helps to use it in development to ensure you won’t run into issues in the future.
