<!DOCTYPE html>
<html lang="en">
<head>
<title>
</title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/custom.css" />
</head>
<body>
<a href="http://www.google.co.in">Google</a>
<script type="text/javascript" src="js/jquery-3.1.1.min.js" ></script>
<script type="text/javascript" src="js/custom.js" ></script>
</body>
</html>
below is code in custom.js
$(window).on('beforeunload',function (){
alert("abc");
});
I want the page to show an alert before going to next page after clicking the link, but it is not showing.