JavaScript Libraries

Keeping your JavaScript libraries current

Most modern templates, as well as the Zen Cart admin, bundle in the JavaScript library jQuery, as well as other JavaScript libraries.

You must check the versions of any libraries you are importing to ensure that you are running the latest, and not an older version with known vulnerabilities.

Your template’s html_header.php or jscript/jscript_xxxxxxx.* files are common places to check for direct references to old libraries. You will also want to check the includes/templates/YOURTEMPLATE/jscript folder to see if there are old versions stored there.

Remember that addons to templates often bring in their own jQuery version that is likely older than the one you want to use for your template. Make sure you’re only loading one copy of jQuery, and that the copy you are loading is current and compatible with all the other JavaScript and/or jQuery features you’re already using.

A very easy way to test whether your libraries are current is to use Google Lighthouse utility. In Google Chrome, right click and select “Inspect.”

Inspect

Then in the dialog that comes up, on the right side, click “Lighthouse.”

Lighthouse

Click the Generate Report button, and look under “Best Practices.” The message in this screenshot indicates that the Bootstrap and jQuery libraries need to be updated.

Lighthouse error




Still have questions? Use the Search box in the upper right, or try the full list of FAQs. If you can't find it there, head over to the Zen Cart support forum and ask there in the appropriate subforum. In your post, please include your Zen Cart and PHP versions, and a link to your site.

Is there an error or omission on this page? Please post to General Questions on the support forum. Or, if you'd like to open a pull request, just review the guidelines and get started. You can even PR right here.
Last modified March 31, 2021 by Scott C Wilson (1d80e228).