Skip to content

Add identifying attribute to HTML elements injected into game's index.html #1083

@Ragzouken

Description

@Ragzouken

For the past two years this project has been working fine but recently is broken: https://candle.itch.io/flicksy

it seems the resources are being split over multiple origins but without the CORS policy set correctly? this occurs during tool's export process which fetches the javascript and css source files of the tool to bundle a copy of itself

Access to fetch at 'https://static.itch.io/htmlgame.js' from origin 'https://v6p9d9t4.ssl.hwcdn.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Disregard the above, I misunderstood the problem I encountered.

I didn't realise it until now, but the change described at https://itch.io/t/614172/sitelock-update?before=28#post-1550434 broken my tool, and I now understand it's because itch is injecting extra script element's into my tool's html page.

I'm dynamically inspecting the page's script elements as part of the tool's export process (and naturally, assuming that the only elements are the ones I put there)--the extra element tripped this process up (because that particular script doesn't have a favourable CORS policy, but I realise now that I don't actually want to be able to fetch it anyway).

I can understand why you might want to do this, but could you add some identifying attribute to the tag so I can detect that it was injected? Perhaps <script data-itch-injected ...> or similar? Right now my workaround to check jsScript.src !== "https://static.itch.io/htmlgame.js" which feels liable to break.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions