Welcome Guest Search | Active Topics | Sign In | Register

Cached Javascript Files on Browser Options
Philipp Jenni
Posted: Friday, October 16, 2015 11:35:53 AM
Rank: Advanced Member
Groups: Member

Joined: 6/9/2007
Posts: 98
Hi,

I use the "eo_ScriptLocation" property to write the javascript files of eo.web to the webserver disk. When i update
the web application with EO.Web, then i clean the "eo_ScriptLocation" to prevent clients to use old javascript files.
All files are recreated correct by the eo.web. Now i have some clients the won't use the new javascripts files from
the server and generate javascript errors on client.

To use the Handler is not an option.

How i can fix this problem?

Kind regards
Philipp
eo_support
Posted: Friday, October 16, 2015 1:10:28 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

There isn't much you can do for this case from the server side. This is a browser side caching issue. The client browser must explicitly refresh the page in this case, that means the user either has to click the "Refresh" button, or has to clear their cache.

Thanks!
Philipp Jenni
Posted: Friday, October 23, 2015 1:57:54 AM
Rank: Advanced Member
Groups: Member

Joined: 6/9/2007
Posts: 98
I have seen, that files are created always with the same name on the server. Could generate a random name per EO Version. This should be solve the problem. It's also a possbility to include the version in the filename or use as a parameter in the HTML includes.
eo_support
Posted: Friday, October 23, 2015 10:33:17 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

Yes. That's correct. Every build uses different file names. However there are also inline JavaScript code in your page that references them. So when you have old inline JavaScript code on the client (due to browser caching) and new files on the server, the client side JavaScript which relies on the correct server side file to be downloaded would not function properly and gets JavaScript error. In this case the end user must refresh the page so that the can get the new matching inline JavaScript in your page.

Thanks!
Philipp Jenni
Posted: Friday, October 23, 2015 12:26:07 PM
Rank: Advanced Member
Groups: Member

Joined: 6/9/2007
Posts: 98
That's not correct. Only the files with the eo.*.js Names are changing. Files with eo_ldr_i_fmt_u_c*.js never change the name, and these files are loaded from the client.
eo_support
Posted: Friday, October 23, 2015 12:55:39 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

Please do not use set this property to true:

http://www.essentialobjects.com/doc/eo.web.scriptmanager.combinejsfiles.aspx

When you set this property to true, you will have files like eo_ldr_i.*.js. Those files won't have different names. If you do not use CombineJSFiles feature, it will jut be those files with unique IDs.

Thanks!
Philipp Jenni
Posted: Saturday, October 24, 2015 2:22:19 AM
Rank: Advanced Member
Groups: Member

Joined: 6/9/2007
Posts: 98
I should be generated also unique files when i use CombineJSFile. When i disable this feature is that an performance issue
when i use the application on mobile devices.
eo_support
Posted: Saturday, October 24, 2015 10:27:14 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

We do not have any plans to use unique file names when using CombineJSFile since it's always a trade off between cache and functionality. When you cache files you will always run into the possiblity of having a staled copy. That's why there is a refresh button for the browser. It doesn't make much of a difference between the file is missing (due to name changes) or the file is of the wrong version, in both cases your page will run into JavaScript error and stops functioning.

Thanks
Philipp Jenni
Posted: Tuesday, October 27, 2015 10:06:39 AM
Rank: Advanced Member
Groups: Member

Joined: 6/9/2007
Posts: 98
If create a unique filename per version you never had a caching problem. You include a javascript what the client never has downloaded, so it will get from the server. If you use the same filename from the last version, the client see, that it has the file in the cache and won't download the new one from the server.
eo_support
Posted: Tuesday, October 27, 2015 10:25:05 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You will still have cahcing problem even if we create a unique name for every build --- even though maybe a little bit less problem. The problem occurs when your client browser has an old page that refers to the old unique file name which no longer exists on your server. The user will still run into JavaScript error in that case. They just have to refresh the page when this happens.

Thanks!
Philipp Jenni
Posted: Tuesday, October 27, 2015 11:14:30 AM
Rank: Advanced Member
Groups: Member

Joined: 6/9/2007
Posts: 98
That is correct, but i have verified the rename solution. I have changed the eo_scriptdir property after the update of eoweb, and this solves any javascript problems. So it looks like, the browser can handle cached pages better than js files.
eo_support
Posted: Tuesday, October 27, 2015 11:45:13 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
It can sometimes (has to do with the "age" of the cache) and it can not sometimes. Web page caching is a very old and generic topic and the corresponding standard are well defined and implemented. You can search online and you should be able to find plenty of information about this. Just like every cache implementation, the reason we do not change the combined JS file name is for performance reason --- at the cost of you may run into a staled copy. The fact that it worked for you doesn't mean it will work for everyone. Both the theory and the standard are pretty clear on this. So we will not change our code just because it may work for your case. As such please consider this issue closed.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.