B4J Tutorial Cache for WebApp was keeping previous version of .js file - How to fix

This was the first time I faced something like this and it was Chrome's fault. Here is what happened:

I added in a .js file a new javascript function. When I tried to call it, Chrome was saying that the function was not found. Wondering completely what is going on I right clicked on the page and clicked on "inspect". Then I went to look the sources of the page there. To my surprise I noticed that the .js file was in the previous version. I started a new incognito session in chrome and the file was in the current correct version. I was sure it was cache so searching I found this: In order to get the page to start fresh in Chrome, you have to right click the page and select "inspect". With the tools showing you go the the refresh button and right click and select "Empty cache and hard reload". Then everything starts fresh and brand new to the latest versions of the files.
 

aeric

Expert
Licensed User
Longtime User
This was the first time I faced something like this
I was there 3,000 years ago... 😅
It was and is very frustrating.
Clearing all the cache means you also lose other data such as Form autocomplete or login cookies.

I have 2 solutions.

Solution 1:
1. Inspect with web browser's Web Developer Tool.
2. Follow the link to the JS (CSS or image) file.
3. Rightclick on the page and Click Reload.
4. Repeat 1 or more times if you feel more concern.

Solution 2: (Not always work but worth a try)
1. Copy the link to the asset file and paste to the address bar.
2. Append something like "?v2" in the URL and press Enter.
3. Repeat 1 or more times if you feel more concern.

If the above still not work then only I will clear the storage data on Application tab in Developer Tool.
 

Daestrum

Expert
Licensed User
Longtime User
(may be total rubbish) but couldn't you just call location.reload() and reload the web page which should now reflect any changes.
 

hatzisn

Expert
Licensed User
Longtime User
I was there 3,000 years ago... 😅
It was and is very frustrating.
Clearing all the cache means you also lose other data such as Form autocomplete or login cookies.

I have 2 solutions.

Solution 1:
1. Inspect with web browser's Web Developer Tool.
2. Follow the link to the JS (CSS or image) file.
3. Rightclick on the page and Click Reload.
4. Repeat 1 or more times if you feel more concern.

Solution 2: (Not always work but worth a try)
1. Copy the link to the asset file and paste to the address bar.
2. Append something like "?v2" in the URL and press Enter.
3. Repeat 1 or more times if you feel more concern.

If the above still not work then only I will clear the storage data on Application tab in Developer Tool.

I am not keen in developing web apps and being a biginner I though this was the only solution since I have never faced that before. I will try both but for the second I am sure it will work since when I was developing a download file javascript sub this was the solution to download a new file each time you press download (it was thought adding the time and not ?v2).
 

hatzisn

Expert
Licensed User
Longtime User
(may be total rubbish) but couldn't you just call location.reload() and reload the web page which should now reflect any changes.

I was adding some subs and I am not a bada** javascript developer. I believe though that you are referring to that I was supposed to do this in console right? If yes it is the same as refreshing the page which I did several times.
 

aeric

Expert
Licensed User
Longtime User
I am not keen in developing web apps and being a biginner I though this was the only solution since I have never faced that before. I will try both but for the second I am sure it will work since when I was developing a download file javascript sub this was the solution to download a new file each time you press download (it was thought adding the time and not ?v2).
Ya, I think some frameworks add a timestamp or random number.
 

Daestrum

Expert
Licensed User
Longtime User
I should have put location.reload(true) which forces a reload of the page ignoring cache
 
Top