runtime.createWorker() HTML Export to itch.io

0 favourites
  • 3 posts
From the Asset Store
Shark.io
$49 USD
Shark.io in the sea full of killer sharks, Sunday of life is the game. Who knows what is happening under the sea?
  • Hello!

    I have been having fun learning how to use workers for some things. I have it working great on preview but when I go to export to HTML and upload to itch, I get a 403 error.

    I have tried different ways other than below such as "./repulsionworker.js"

    repulsionWorkerPort = await runtime.createWorker("repulsionworker.js");

    This all works in preview but not on itch.io.

    Is this something that I can fix in my game or is it tied to itch.io?

    Thanks!

    Foozle

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • HTTP 403 means "Forbidden", so this sounds like something to do with the server configuration on itch.io. You'd probably need to talk to them about it.

  • I was able to solve eventually with some help from Mikal. Note that after I exported to html, I had to copy the worker.js file to the top level folder before rezipping for it to work.

    I also had the same issue when exporting to WebView2 which was also solved by editing the export by copying the file to the top level.

    In my main.js I created the worker as shown below.

    repulsionWorkerPort = await runtime.createWorker("./repulsionworker.js");

    Foozle

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