Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am making a website in PHP. I want that any one who go to my website can visit any page and can do 1 free click any where but after one click if the user is NOT SIGN IN it will show a modal box any time the user clicks anywhere.

How do I implement that???
Posted
Comments
Palash Mondal_ 26-Sep-15 8:45am    
Can you use jQuery or just javascript? Is the popup window is the normal popup window or a bootstrap modal popup?

You can take help of HTML5 Local Storage or Session Storage according to your requirements. You can also store in cookies.

Store one count in these storage options and when user clicks again check the count value and show the popup.
 
Share this answer
 
Comments
[no name] 26-Sep-15 9:11am    
Eheh, a 5!
A simple jquery solution would be:

JavaScript
var counter = 0;
$(document).on('click',function(){

counter++;
if(counter == 2)
 //show modal code here
});
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900