Wednesday, 24 July 2013

HOW TO SHOW MESSAGE BEFORE VISITOR CLOSE MY WEBSITE

HOW TO SHOW MESSAGE BEFORE VISITOR CLOSE  MY WEBSITE



Well this is a nice way to change your website's visitor's mind and keep him engaging on your website. Well After visiting your website whenever user close your website from his/her browser or close the Tab of your website then you can do something good before it which can change your visitor's mind and you may engage him on your website by telling him something very interesting on ALERT MESSAGE BOX. Well this is so easy and as well as a very nice SEO trick which you should apply if you run any blog or website.


This trick will simply work when your visitor is going to close your website and as soon as he clicks on close tab he will get an Alert Message with the custom Text which is set by you.

This trick is used by many E-Commerce websites to show their promotional offers and to show that what you can miss if you close our website right now.

So simply you just need to a simple JavaScript in your Source code. just copy and paste the code below before </head> tag.


<script type="text/javascript">
window.onbeforeunload = function() {
return "Are You Sure You Want To Exit? Why Don't you check our Popular posts , I am sure u will like it?"
 }
</script>


Well in this JavaScript we have used the ONBEFOREUNLOAD event which  occurs when the user navigates away from the page (by clicking on a link, submitting a form, closing the browser window, etc.

So just copy the above JavaScript and paste it with the desired attractive message in it which can attract the visitors. I think all is clear in your mind that how this easiest JavaScript is working. Well if you face any kind of problem then simply comment below. :)

No comments:

Post a Comment