keepalive.js…:1 Uncaught TypeError: Cannot read property 'uri' of undefined
<script type="application/json" class="joomla-script-options new">{"system.keepalive":{"interval":840000,"uri":"\/index.php\/en\/component\/ajax\/?format=json"},"joomla.jtext":{"JLIB_FORM_FIELD_INVALID":"Invalid field: "}}</script>
<script type="application/json" class="joomla-script-options new">{"joomla.jtext":{"JLIB_FORM_FIELD_INVALID":"Invalid field: "}}</script>
Category | ⇒ | com_cache JavaScript |
Status | New | ⇒ | Confirmed |
Issue confirmed:
Further info: seems JHtml::_('behavior.keepalive');
(that introduces that code) is not called in progressive cache mode (in no cache mode or conservative caching works).
In my case the keepalive was called by mod_login (the login box module)
A workaround is to disable progressive caching, but yes, confirmed the issue also.
Ok, so IMO there are two sides of this issue:
JHtml::_('behavior.keepalive');
inside the mod_login template file is not being processed when cache in conservative mode.Proposed a PR to try to solve "2." #16452 - please test.
Reggarding "1." have no idea - maybe someone that understands better the cache system can help.
Thank you very much, I will try
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-06-03 04:32:42 |
Closed_By | ⇒ | franz-wohlkoenig |
closed as having PR #16452
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/16375
@franz-wohlkoenig the PR does not solve one part of the issue. Imho Should remain open until someone looks at the progressive cache issue
Status | Closed | ⇒ | Discussion |
Closed_Date | 2017-06-03 04:32:42 | ⇒ | |
Closed_By | franz-wohlkoenig | ⇒ |
Status | Discussion | ⇒ | New |
Closed_Date | 0000-00-00 00:00:00 | ⇒ |
Set to "open" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/16375
reopened
@franz-wohlkoenig maybe the cache issue is the same thing as #11203 but not sure
Status | New | ⇒ | Discussion |
Generelly, is keepalive neccessary in frontend? For example in login form? Or in Contact form. It could compromise security, as for example in contact it will keep user logged in even he leaves computer...
Keepalive is used in forms because of the crsf token check. Anyway this issue as describe above is not a keepalive issue. is the progressive cache that makes this behaviour
Hi
#11203 does not appear to me as the same thing:
- The fix does not apply anyway, as it applied to controller and views, which are not used in modules
Ok, my misunderstanding
- #11203 happens with conservative caching, while this one is with progressive. Progressive being supposed to be more agressive caching, this kind of side effect might happen. Would be good to confirm whether the same happens with only conservative caching enabled or not.
Only progressive cache.
- Agree that this should not cause a JS error, error should be caught and properly displayed
A PR was done to solve the keepalive js issue (better fallback), but since core.js is not loaded it can cause other js issues in other similiar situations.
- Maybe caching for such modules should simply be disabled by users when progressive caching is enabled?
Not sure, this in principle would apply to all modules in such situations, right?
Doesn't seem the solution would be disabling cache in all modules that load a behaviour that loads core.js. There must be something that prevents core.js from being loaded in this scenario.
Hi
There must be something that prevents core.js from being loaded in this scenario.
Yes, it's caching. If the module is cached, then its PHP code is not executed, and thus any instruction such as loading js, css or any other type of action is not executed at all. Note that the same probably happen if the module is supposed to record something in the database for instance.
So basically such a module is not compatible with being cached, which is why it should be disabled IMHO.
Rgds
Yes, it's caching. If the module is cached, then its PHP code is not executed, and thus any instruction such as loading js, css or any other type of action is not executed at all. Note that the same probably happen if the module is supposed to record something in the database for instance.
I don't understand how this conservative and progressive cache works (never used it), but if php code is not executed, why is keepalive.js rendered?
See https://github.com/joomla/joomla-cms/blob/staging/modules/mod_login/tmpl/default.php#L14
Most likely because keepalive is rendered as part of the HTML of the module, inlined. And so it's cached with the rest of the content.
is behavior.keepalive
that calls for core.js to be rendered (see https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/html/behavior.php#L709)
yes, exactly. Because the PHP part is not executed, the core.js is not linked. But the keepalive settings
<script type="application/json" class="joomla-script-options new">{"joomla.jtext":{"JLIB_FORM_FIELD_INVALID":"Invalid field: "}}</script>
are simply output as part of the HTML and are cached.
doesn't that part is rendered in the same place as the js scripts, ie, in JDocument head render?
See https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/document/renderer/html/head.php#L236
Yes, so maybe it's called by something else (the page itself, another module). But the problem is the wrong configuration snippet?
You would need to be able to reproduce on a standard install, and then step through code to know...
I just ran into this, and it affects more than just keepalive. Any script option I set in a content plugin is also lost.
Any script declaration I set remains with caching enabled.
Status | Discussion | ⇒ | Confirmed |
Thank you for raising this issue.
Joomla 3 is now in security only mode with no further bug fixes or new features.
As this issue doesn't relate to Joomla 4 it will now been closed.
If we are mistaken and this does apply to Joomla 4 please open a new issue (and reference this one if you wish) with updated details for testing in Joomla 4.
cc @zero-24
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-08-23 13:48:26 |
Closed_By | ⇒ | zero-24 | |
Labels |
Added:
No Code Attached Yet
Removed: ? |
Hello,
I have the same issue.
Make click right on the window and show source. This give me the same lines
<script type="application/json" class="joomla-script-options new">{"system.keepalive":{"interval":1740000,"uri":"\/index.php?option=com_ajax&format=json"},"joomla.jtext":{"JLIB_FORM_FIELD_INVALID":"Champ invalide : "}}</script>
and cause some issue with dropeditor ( lines above)
php 7.1.5
Joomla 3.7.2
picture
Best Regards
Melvine