0

So I've recently made this Website and they wanted a message at the top of the Website to let everyone know they were still updating the Website and should expect changes to the site. Although I made this message whenever anyone closes the message and then refreshes the page the message pops back up and I don't want this to happen.

How do I go about storing their IP Address so when they close the message it never re-appears.

I couldn't find the answer anywhere but if it has already been asked if you could point me in the direction of the answer that would be great. Thanks :)

Stephen
  • 515
  • 1
  • 14
  • 31
  • similar: [read/write cookie](http://stackoverflow.com/questions/4825683/how-do-i-create-and-read-a-value-from-cookie) [javascript cookies](http://stackoverflow.com/questions/14573223/set-cookie-and-get-cookie-with-javascript) – Wasim Dec 07 '15 at 14:48

1 Answers1

1

As far as I know, there isn't a way to do that with just HTML. The way I would tackle it is to use simple JavaScript to store/check for a cookie and display/hide a message respectively.

the cookie is part of the document object in JavaScript, if you're not familiar with JavaScript, or just looking for some explanations then feel free to Google "JavaScript Cookies" or check this link for a simple tutorial from w3schools.

Also, just to explain why I would choose cookies over storing IP addresses, this approach (cookies) does the job on the front-end, which transfers the overhead into the client's machine. While storing IP addresses (or tackling the problem in a similar manner) requires a server-side solution, which means slighlty more things for your server to do, and a lot more for you to do (You'll need to code that in PHP or so in order to implement it on the back-end).

I hope my answer get you on the right track.

Good luck with your project.

P.S some countries' regulations require you to display a disclaimer of some sort just to let the customer know that "Our website uses Cookies to store information on your device", make sure you cover that base in case you go for Cookies.

Marwan Alani
  • 286
  • 1
  • 6
  • Thank you. I think I didn't explain my situation as good as I could of. For example I didn't mean store there IP Address in HTML or anything I mean when they close the message then the message never appears even after they refresh because when they refresh at the minute the message reappears after being closed. Basically when they close the message I want a cookie to store data that they have closed the message and when they refresh the message is automatically hidden from there device if you know what I mean. Your answer has helped me understand and I thank you for your answer :) – Stephen Dec 07 '15 at 15:18
  • Also I thought you could store an IP Address in a cookie but obviously not xD I didn't know that but now I do so thank you again. – Stephen Dec 07 '15 at 15:20