View Full Version : Code for one-time only pop up

Mike F
08-10-2012, 09:39 AM
I found this code on a very useful site, javascriptkit.com.

How do I change this from a 'once per session' pop up to 'one time only'? Is it as simple as changing (once_per_session==0) to (one-time-only==0)

You can view it on my website: www.polarisgolf.eu

I would be very grateful if anyone could help me with this.


//Alert message once script- By JavaScript Kit
//Credit notice must stay intact for use
//Visit http://javascriptkit.com for this script

//specify message to alert
var alertmessage="We use cookies to make our website work properly. See the links page for details."

///No editing required beyond here/////

//Alert only once per browser session (0=no, 1=yes)
var once_per_session=1

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
return returnvalue;

function alertornot(){
if (get_cookie('alerted')==''){

function loadalert(){

if (once_per_session==0)


08-10-2012, 09:58 AM
var once_per_session=1
need to change 1 to 0

like this ?

Mike F
08-10-2012, 05:24 PM

You said 'like this?', so I take it you're not sure and you're taking a guess?

I could try it on a test page if you're not 100% sure.