Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

178
Views
¿Cómo calcular el tiempo de carga de la página usando JQuery?

Estoy escribiendo mi propio sitio como tarea y mi maestro me pide que escriba un script que calcule el tiempo de carga de la página y lo escriba en el pie de página, lo escribo usando JS, pero quiero escribirlo usando Jquery, pero no entiendo cómo hacerlo. Aquí está mi código usando JS:

 let loadTime = (function () { let now = new Date().getTime(); let page_load_time = now - performance.timeOrigin let time_load = page_load_time / 1000; return time_load.toFixed(4); })();
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Prueba esto :

 var beforeload = (new Date()).getTime(); function getPageLoadTime() { var afterload = (new Date()).getTime(); seconds = (afterload - beforeload) / 1000; $("#load_time").text('Loaded in ' + seconds + ' sec(s).'); } window.onload = getPageLoadTime;
 p { font-size:50px; text-align: center; font-family: HelveticaNeue, Helvetica, Arial, sans-serif; color: #000; }
 <!DOCTYPE html> <html lang="en"> <head> <title>Check Time</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head> <body> <p id="load_time"></p> </body> </html>

about 4 years ago · Juan Pablo Isaza Report

0

No hay necesidad de complicar la función fácil, use esto

 window.onload = function () { var loadTime = window.performance.timing.domContentLoadedEventEnd - window.performance.timing.navigationStart; console.log('Load time: '+ loadTime); }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!