News:

Support the VirtueMart project and become a member

Main Menu

Script loading

Started by semen_123, June 27, 2023, 10:43:43 AM

Previous topic - Next topic

semen_123

I want to load scripts jquery-ui.min.js asynchronously (defer, async) on the site front.
If I change the code:
               
               //if($jsToAdd['defer']){
$attribs['defer'] = 'defer';
//}

//if($jsToAdd['async']){
$attribs['async'] = 'async';
//}


in the file vmjsapi.php then the administrative part of the site stops working.

What do i do?

I need to lower the FCP LCP CLS scores on the site

These Virtuemart scripts block the first rendering of the page

Version VM: 3.8.9 10473

jenkinhill

VM: 3.8.9 10473 is over 2 years old, a lot of changes have been made since then. LCP, FID, and CLS scores are likely to be lower in later versions, now at 4.0.22
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Studio 42

A simple solution is to verify if you are in the front site or not
For eg. you can use this code to check if you are in the Joomla admin or not
//  whe are in front ?
if(JFactory::getApplication()->isClient('site') ){
}



//  whe are in admin?
if(JFactory::getApplication()->isClient('administrator') ) {
}

semen_123

Quote from: jenkinhill on June 27, 2023, 12:00:58 PM
VM: 3.8.9 10473 is over 2 years old, a lot of changes have been made since then. LCP, FID, and CLS scores are likely to be lower in later versions, now at 4.0.22
I asked a question about the formation of SEO URLs of pages in version 4, the problem was not solved. What's the point of putting version 4 instead of 3, if there are bugs in it too. I asked for simple advice, not advice on switching to a fresh version.

semen_123

Quote from: Studio 42 on June 27, 2023, 14:23:37 PM
A simple solution is to verify if you are in the front site or not
For eg. you can use this code to check if you are in the Joomla admin or not
//  whe are in front ?
if(JFactory::getApplication()->isClient('site') ){
}



//  whe are in admin?
if(JFactory::getApplication()->isClient('administrator') ) {
}


Thanks for the idea! 

pinochico

we use postload from rupostel
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

semen_123

Quote from: pinochico on June 27, 2023, 19:37:44 PM
we use postload from rupostel

Rupostel is a site within a site, why so many headaches? But thanks anyway. Made according to the idea from Studio 42

pinochico

Postload is plugin and system how load all script and css from Rupostel.com and is core system plugin from OPC .

You can see on live etc. on www.cannadorra.com

Welcome
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products