VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: semen_123 on June 27, 2023, 10:43:43 AM

Title: Script loading
Post by: semen_123 on June 27, 2023, 10:43:43 AM
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
Title: Re: Script loading
Post by: 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
Title: Re: Script loading
Post by: 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') ) {
}
Title: Re: Script loading
Post by: semen_123 on June 27, 2023, 16:26:48 PM
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.
Title: Re: Script loading
Post by: semen_123 on June 27, 2023, 16:28:11 PM
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! 
Title: Re: Script loading
Post by: pinochico on June 27, 2023, 19:37:44 PM
we use postload from rupostel
Title: Re: Script loading
Post by: semen_123 on June 27, 2023, 20:11:12 PM
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
Title: Re: Script loading
Post by: pinochico on June 27, 2023, 22:12:12 PM
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