1
How to make Javascript run only once per visitor (type if already registered in the browser’s cokkies, no longer run).
<?php
     $tmp='<script>
     Push.create("Olá Mundo!", {
                      body: "Esta é uma mensagem nova",
                      icon: "images/logo.jpg",
                      timeout: 4000,
                      onClick: function() {
                               window.location="http://www.google.com";
                               this.close();
                      }
                  });
            </script>';
            echo $tmp;
?>
						
cookie recorded by who? php? javascript?
– user60252
javascript itself.
– Leufeitosa Feitosa
and as you set the cookie?
– user60252
friend I’m trying but I couldn’t do.
– Leufeitosa Feitosa
You are using PHP because you do not create and check the cookie with PHP. Hence it only gives echo $tmp; if the cookie does not exist or has expired
– user60252
Thank you very much! Solved.
– Leufeitosa Feitosa
I posted a reply based on the comment, and read this post https://pt.meta.stackoverflow.com/questions/1078/como-e-por-que-aceitar-uma-resposta/1079#1079
– user60252