(please share the FULL error message you see, if applicable)
Other Information
I’ve created a website that uses JavaScript along with PapaParse to read and display data from a CSV file. The CSV data should load and display automatically when the page loads. When I run the site locally on my laptop, this works perfectly. However, when I host the site on InfinityFree, the data doesn’t display on page load.
Interestingly, when I use a button to initiate the CSV reading and data display (i.e., the action isn’t tied to the page load), it works as expected, even on InfinityFree.
Are there any specific restrictions on InfinityFree that could be causing this issue? Or could there be something I’m missing in my implementation? I’ve checked the console for errors, but didn’t find any related to this issue.
If it’s all running the browser, the server OS shouldn’t really matter. If it works on your own computer but not here, the first thing that comes to mind is browser sandboxing. Some Javascript features are blocked from running on page load, or restricted when not using HTTPS, for security considerations by browser makers. Browser makes generally make an exception for the localhost URL, so web developers can test their code locally without having to setup HTTPS for localhost for example.
Another possible option that just came to me is that our hosting enforces quite strong browser caching by default, so it may be that your browser is using an older version of your Javascript code, which may still have issues you already fixed in the real code. The most reliable way to circumvent this is to check the page in Incognito Mode.
Finally, I’m not entirely sure what doesn’t work exactly on your site. Can you please point out where on your site exactly we can see this CSV loading in action?
Ok so the data is loading for you, and the tile and list view buttons are working for you?
What browser are you using for some reason it’s not showing up for me if i use chrome or edge but it works if I run it locally.
The reason is browser cache. Our hosting attached some additional information along with all static files saying the browser should cache them for a long time. When that happens, next time you visit the page, the browser doesn’t download the files again and just reuses the files it downloaded before.
Usually cache is good, because it reduces server load, makes the site load faster and saves bandwidth for both the visitor and the server. The downside is that changes take longer to take effect because browsers do not download the latest version of the code.
You can clear the cache of your browser through the settings. But for development, you may want to use Incognito Mode to circumvent it entirely.