"Stay on Page" Exit Popup using Jquery


stay on this page

I hope each and every web surfers are aware of this exit popup function. The purpose why I've used Jquery function here is, "stay on page or leave the page" exit popup can be created without using Jquery but the major drawback of it is, it keeps on showing exit popup even if a user click on any internal link too. So to overcome this drawback, I have used Jquery java-script function here which ensures that the "stay on page" exit popup pops only when the visitor try to leave your site and not when a visitor clicks on any internal link.

...............................................................................................................................................
Stay on Page or Leave this page exit popup
...............................................................................................................................................

Install "Stay on page" exit popup on blogger

1.Go to blogger dashboard --> Template --> Edit html.

2. Find(Ctrl+F) for </head> tag and place the following peace of code just above it.
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'/>
<script type='text/javascript'>
     function PopIt() { return &quot;Are you sure you want to leave?&quot;; }
     function UnPopIt()  { /* nothing to return */ }

     $(document).ready(function() {
      window.onbeforeunload = PopIt;
$(&quot;a&quot;).click(function(){ window.onbeforeunload = UnPopIt; });
     });
</script>

  • Replace Are you sure you want to leave? with your desired words.

3. Save the Template.

Related product you might see:

Share this product :

Post a Comment

Blogger Tips and TricksLatest Tips And TricksBlogger Tricks
 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Blogger Hacker - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger