-2

I want to add a popup to my website!

I want the popup to apper only once per user and should be dismissable .If the user closes the popup the popup can be again opened using a button click if the visitor is interested to rate the service.

How to do that? I'm using materize css , i tried modal but it opens each time the website is loaded

  • If you have the users logged in, the best way would be to store this in your database. It's the only reliable way of doing it. Using cookies or browser storage means that the user will get the message when they use a different browser, when they use a different device or when they simply clear all offline files. – Philip Dec 28 '17 at 09:47
  • I'm not using a login system for the site – Vithul T Nair Dec 28 '17 at 09:50

2 Answers2

0

You will need to track information of which user was the popup already shown.

Keep the info on client side such as cookie or server side such as session/profile.

Local Storage vs Cookies

Window.localStorage MDN web doc

ino
  • 2,345
  • 1
  • 15
  • 27
0

You can create a variable which stores the weather the popup for the user has been opened or not. Store this variable in the browser cookies.

Ajay Pratap
  • 437
  • 4
  • 14