Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!--
A simple JS code snipet for Print Page Load Time in Second.
• Obiviously you don't need jQuery and notify.js . Just remove two CDN link and remove $.notify(notify_msg, "success");
-->
<html>
<head></head>
<body>
<div class="classname">
<img src="https://cwsmgmt.corsair.com/newscripts/landing-pages/wallpaper/v4/Wallpaper-v4-2560x1440.jpg" alt="">
</div>
<!-- put everything you need in here -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/notify/0.4.2/notify.js"
integrity="sha256-7NgI/5l45Md7VEbs4MGG4HsRoHu+lXKQ/vUK1LvXDps=" crossorigin="anonymous"></script>
<script>
window.onload = function () {
var loadTime = window.performance.timing.domComplete - window.performance.timing.navigationStart;
var loadTimeInSec = loadTime / 1000;
var notify_msg = 'Page load time is ' + loadTimeInSec + ' s';
console.log(notify_msg);
$.notify(notify_msg, "success");
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment