PrestaShop Documentation, PrestaShop Tutorials

PrestaShop How to show page load time in the bottom of the page.

ghfgjgjgjhgjhjjh - PrestaShop How to show page load time in the bottom of the page.

{literal}
<p id=”loadTime” style=”font-size: 16px; font-weight: bold; text-align: center;color: blue;”>Calculating…</p>
<script>
window.onload = function () {
let performanceData = window.performance.timing;
let loadTimeMs = performanceData.loadEventEnd – performanceData.navigationStart;

// Convert to seconds and milliseconds
let seconds = Math.floor(loadTimeMs / 1000);
let milliseconds = loadTimeMs % 1000;

// Format the output in a more readable way
let readableTime = seconds > 0
? `${seconds} second${seconds !== 1 ? ‘s’ : ”} and ${milliseconds} milliseconds`
: `${milliseconds} milliseconds`;

document.getElementById(“loadTime”).textContent = `Page Load Time: ${readableTime}.`;
};
</script>
{/literal}

 

ghfgjgjgjhgjhjjh 300x169 - PrestaShop How to show page load time in the bottom of the page.

About zohaibk

We develop useful addons for #E-Commerce and #CRM software to provide extra features.#PrestaShop,#Magento,#SugarCRM,#Vtiger & #Android #apps
View all posts by zohaibk →