Cache (?) issue; can't update javascript script

Site: priv.nexbit.ca

Error message: (I’m limited to 2 links in my post, so imagine the https:// still being there)
Access to script at ‘errors.infinityfree.net/errors/403/’ (redirected from ‘priv.nexbit.ca/game/chat.js’) from origin ‘https://priv.nexbit.ca’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Hello!
I’ve been having issues related to modifying a script running on my website. My script used to be called chat.js, but I learned that infinityfree didn’t support that, so I decided to rename it to tester.js.
My page game.html calls index.js, which is supposed to call tester.js, except it didnt seem to update and still calls chat.js.
Is this a cache issue on infinityFree’s side? I always use incognito mode and have tried different computers.
Thanks for the help,
Toni

some more details:

in game.html, I have this:

note: the log is sent correctly.

in index.js, I’ve got this:
import {Chat} from “./tester.js”;
this line is what used to be chat.js.

seems it deleted the lines I pasted that are in game.html…
it’s calling index.js with a version value to force the browser to update it
then, a console.log line to make sure that the new version of game.html is running

I also have a .htaccess file in the parent folder that should in theory prevent caching

doing ctrl+f5 while looking at index.js on my browser, does seem to make it update, but it doesn’t stay…

Did you see this article already?

The keyword “chat” is blocked on our servers, because live chat scripts are not allowed on our hosting. That’s why the request to chat.js is blocked.

3 Likes

yes I know, I’ve seen the page…
As I said in my post, my issue is about changing the name of the script. I renamed it to tester.js, but now, my index.js doesn’t seem to update to the new version that calls tester.js.
I’m using SFTP using firezilla, and the files there should work…

This sounds like browser cache issue. Try clearing your cache.

And note that if you are just renaming the file to get around the limitations, your account will still get suspended.

4 Likes

But the chat isn’t hosted trough infinityfree? I thought that would be fine…
I’m using incognito mode and tried other computers and other browsers and ctrl+f5

the chat is just part of the game im making, if running a game with infinityfree isn’t fine then I can remove it ig

to be clear: the game server IS HOSTED SOMEWHERE ELSE

Yes, that’s no problem.

The game server or the chat server?

Do the chat messages pass through our servers, or are they sent directly from the visitors’ browsers to the chat server?

I see you’re also using Cloudflare. Cloudflare’s “performance enhancements” mainly revolve around cache. So while developing your website, you may want to enable development mode in Cloudflare too so any changes you make to your website are immediately visible.

Or just purge Cloudflare’s cache, in addition to your browser cache, after making changes.

6 Likes

the whole game and chat are hosted externaly, so no problem there… Thanks.
I tried investigating cloudflare’s cache and couldn’t find anything, but I’ll go look at it more, that would make sense.
Thank you!

This article describes how to enable development mode: Development Mode | Cloudflare Cache (CDN) docs

This article describes how to purge the cache of your website: ​Purge everything | Cloudflare Cache (CDN) docs

There are a lot more knobs to tweak how Cloudflare’s cache works. Just know that disabling or reducing caching will slow down your website and increase load on your hosting account, so choose carefully before completely disabling cache to be able to always see instant changes.

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.