0

I'm trying to find a way to make the alert box of:

<div data-alert class="alert-box info radius">
  This is an info alert with a radius.
  <a href="#" class="close">&times;</a>
</div>

permanently disappear after the user clicks the 'x' button in the corner, right now it persists next time the user reloads it reappears in the page which is undesirable. I would like it to not appear again upon refresh once a user clicks the 'x' on the alert.

Edit: You go to the main page, you see a div alert box, not a pop up, then you should be able to click on the 'x' on the alert panel, and the alert should not reappear again after the page is refreshed. link : http://ops.emsofl.com/

2
  • Refreshing a page is the same as going to the page again. Your requirement is that when you go to the page, the popup should appear. The page is working per your requirements. Mar 9, 2015 at 21:03
  • I edited again, because apparently I am not being clear here. Hopefully it makes sense now.
    – Jarg7
    Mar 9, 2015 at 21:05

1 Answer 1

1

You can't guarantee the behavior you want. You can't tell the difference between a page refresh and a second visit to the page.

A common hack used in this situation is to write a cookie to the browser indicating that they've already seen the alert. Don't show the alert when the browser sends that cookie. It assumes the browser honors your cookies.

2
  • I see, I need to write a cookie then, would this be done easily in this mater?
    – Jarg7
    Mar 9, 2015 at 23:22
  • Yes, this is a trivial and typical cookie usage. I'm sure you can find many examples online. Mar 10, 2015 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.