I'm trying to detect when the user refresh the page to redirect using JQuery ,what is wrong in this code? but nothing that I try works
<?php
include 'instagram.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<?php
$inst = new Instagram($_GET['code']);
?>
<script
src="https://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous">
</script>
<script>
$(window).bind('beforeunload', function(){
alert("tryng to refresh");
});
</script>
</body>
</html>