|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
How to create a cookie I lost in the vast Internet resources. Some offer a full paragraph, other 2 lines but does not offer what I want to do etc. I would like a cookie. Preferably in php. The smallest possible and simple cookie that prevents the activation of a javascript if it has already been run once on all of my site. For example with the following code: HTML Code: <script> alert('This script is repeated on every page of my site but do not view that once during the session of the surfer); </script> |
#2
| |||
| |||
Re: How to create a cookie You set a cookie and put a value to "false", for example after you make a condition Code: if($_COOKIE['hello'] == false) { echo 'your script'; setcookie('hello', true); } |
#3
| |||
| |||
Re: How to create a cookie Thank you for your answer The following simple code does not work on my php page. PHP Code: |
#4
| |||
| |||
Re: How to create a cookie You mixed up php and javascipt: PHP Code: HTML Code: <script type="text/javascript"> if(!document.cookie) { alert("first" ); document.cookie = 'visited'; } </script> |
![]() |
|
Tags: cookie, create, javascript, php |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to use ASP to maintain the cookie | Anirvinya | Software Development | 5 | 16-02-2010 03:38 AM |
How to Create a Cookie in PHP? | sivaranjan | Software Development | 4 | 27-01-2010 10:53 PM |
what is cookie in java? | Jabeen | Software Development | 3 | 21-11-2009 02:53 PM |
LG Cookie applications | B e B o | Portable Devices | 2 | 21-09-2009 12:52 PM |
What is a Cookie? | Dharmavira | Technology & Internet | 5 | 18-02-2009 12:33 PM |