Skip to content

Instantly share code, notes, and snippets.

@saif71
Last active November 19, 2019 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saif71/0ee6a407890c3774576f3db27940ab98 to your computer and use it in GitHub Desktop.
Save saif71/0ee6a407890c3774576f3db27940ab98 to your computer and use it in GitHub Desktop.
<!--
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