0

I'd like to find out if a user presses F5 in a web browser before the page was fully loaded. I would like to use this as an indicator to find out if the page load time was too high for the user.

Is there a possibility?

Thanks much!

1

2 Answers 2

1

You can use the before unload event and save info somewhere:

$(window).bind('beforeunload',function(){
     //save info 
});

just notice, that this event will invoke when you close the browser as well.

Sign up to request clarification or add additional context in comments.

Comments

1

with jQuery you can do something like this

var pageLoaded = false;

$(window).load(function(){
   pageLoaded = true;
});

$(document).on('keyup', function(e){
  if (!pageLoaded && e.keyCode == 116)
         alert("f5 pressed before page fully loaded");
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.