jQuery Prompt Alert Dialog Before Leaving a Webpage in Browser Using Browser Full Project For Beginners

 

Welcome folks today in this blog post we will be prompting alert dialog before leaving a webpage in browser using javascript. All the full source code of the application is shown below.

 

 

 

Get Started

 

 

 

In order to get started you need to make an index.html file and copy paste the following code

See also  Build a JSON Formatter or Beautifier in Browser Using HTML5 CSS3 and Javascript Full Project For Beginners

 

 

index.html

 

 

<!DOCTYPE html>
<html>
<body>


<a href="https://google.com">Google</a>






<script type="text/javascript">
  $(window).on('beforeunload', function(){
var c=confirm();
if(c){
  return true;
}
else
return false;
});
</script>

</body>
</html>

Leave a Reply