Cannot read properties of undefined (reading 'registerAjax')

  • Posts: 152
  • Thank you received: 11
1 year 5 months ago #352296

-- HikaShop version -- : 4.7.3
-- Joomla version -- : 4.3.1
-- PHP version -- : 8.0.28
-- Browser(s) name and version -- : Chrome

Reading on SEO forums i moved the scripts down

<jdoc:include type="scripts" />
<jdoc:include type="modules" name="debug" style="none" />
</body>

HikaShop Cart Module active.

Cannot read properties of undefined (reading 'registerAjax') is the error message i see in the browser console.

The message remains unchanged even if I add products to the cart

Is there a solution or do I put the scripts back in alto??

<head>
<jdoc:include type="metas" />
<jdoc:include type="styles" />
<jdoc:include type="scripts" />
</head>

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 5 months ago #352299

Hi,

You can't do it like that. This will move all the scripts from the head at the end of the page, but this means that all the javascript which is inline on the page (and which expects the scripts from the head to be executed before) will be executed before the scripts from the head.
So if you want to do that, you need some code to automatically get the scripts inline on the page and move them to the end of the body, after the scripts from the head. It's possible but instead of just moving one line of code, you need to write a few dozen lines.

Rather than doing that, I would recommend using JCH Optimize:
extensions.joomla.org/extension/jch-optimize/
It can improve the JS loading in a much better way than this and optimize many other things too.

The following user(s) said Thank You: gerryna09

Please Log in or Create an account to join the conversation.

Time to create page: 0.064 seconds
Powered by Kunena Forum