SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard
    Join Date
    Oct 2001
    Location
    Lancaster, PA
    Posts
    3,019
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How to change cookie in popunder script?

    Hi guys,

    Using the popunder code below, can anyone tell me how to set a cookie so the popup will NEVER appear again?

    Thanks - Steve

    Code:
    <script>
    //Pop-under window- By JavaScript Kit
    //Credit notice must stay intact for use
    //Visit http://javascriptkit.com for this script
    //specify page to pop-under
    var popunder="http://www.btechinc.com/exit.html"
    //specify popunder window features
    //set 1 to enable a particular feature, 0 to disable
    var winfeatures="width=500,height=600,scrollbars=0,resizable=0,toolbar=1,location=0,menubar=0,status=1,directories=0"
    //Pop-under only once per browser session? (0=no, 1=yes)
    //Specifying 0 will cause popunder to load every time page is loaded
    var once_per_session=1
    ///No editing beyond here required/////
     
    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 loadornot(){
    if (get_cookie('popunder')==''){
    loadpopunder()
    document.cookie="popunder=yes"
    }
    }
    function loadpopunder(){
    win2=window.open(popunder,"",winfeatures)
    win2.blur()
    window.focus()
    }
    if (once_per_session==0)
    loadpopunder()
    else
    loadornot()
    </script>
    Web Designer or Small Business Owner?
    Need More Leads and More Clients?
    Get Free Marketing Tips, Tricks and Ideas Here!

  2. #2
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is a link to a tutorial on cookies. Perhaps it will help.
    http://www.webreference.com/js/column8/index.html

  3. #3
    SitePoint Wizard
    Join Date
    Oct 2001
    Location
    Lancaster, PA
    Posts
    3,019
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    [QUOTE='requestcode']Here is a link to a tutorial on cookies. Perhaps it will help.
    http://www.webreference.com/js/column8/index.html[/QUOTE]

    Hey - thanks for the link. I'll take a look and see if it'll help!

    Thanks for your reply!

    Steve
    Web Designer or Small Business Owner?
    Need More Leads and More Clients?
    Get Free Marketing Tips, Tricks and Ideas Here!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •