Jump to content

Recommended Posts

Posted

I want to be able to force visitors to my website to visit and acknowledge a disclaimer on the first time they visit, after which they will never see it again. Searching, I have found a couple of examples, neither of which seem to do what I want.

<script>
    $(document).ready(function(){
      if(!$.cookie('welcomeMsg')){
        $(".top").show();
        $.cookie('welcomeMsg', 'Y', { expires: 365*3 });
      }
    });
</script>

and 

<script>
if (localStorage.getItem("visited")) {
    window.location.href = "OneTimePage.html";
}
localStorage.setItem("visited", "true");    
</script>

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...