New content notifier in Javascript

CK CK 3788 
Created at  
593 0 0
Use this cookie to show your visitors what's new on your Web site since their last visit.

newYou.js
now = new Date
expireDate = new Date
expireDate.setMonth(expireDate.getMonth() 6)
lastVisit = new Date(cookieVal("pageVisit"))
document.cookie = "pageVisit=" now ";expires="   expireDate.toGMTString()

function cookieVal(cookieName) {
  thisCookie = document.cookie.split("; ")
    for (i=0; i<thisCookie.length; i  ) {
      if (cookieName == thisCookie[i].split("=")[0]) {
        return thisCookie[i].split("=")[1]
      }
    }
  return "1 January 1970"
}

function newCheck(yyy,mm,dd) {
  lastChgd = new Date(yyy,mm-1,dd)
  if (lastChgd.getTime() > lastVisit.getTime()) {
    document.write("<img src='/img/new-to-you/new.gif' alt='new'>")
  }
}


test.html
<html>
<head>
  <title>kurapa.com test</title>
  <script type="text/javascript" src="newYou.js"></script>
</head>
<body>
<script type="text/javascript" language="JavaScript"> newCheck(2005,2,11)</script> Be sure to check out our new scripts!
<br>
<script type="text/javascript" language="JavaScript"> newCheck(2005,2,3)</script> Have you seen our Tutorials?
</body>
</html>

Tags Cookie Cookie Redirection Form Cookies HTML Javascript Popup Blocking getTime newCheck Facebook X
Comments 0
Similar posts
  1. Let popup once for event dialog or something like that in Javascript
    421
  2. Cookie Redirect
    491
  3. Cookie enabled browser checking in Javascript
    338
  4. Save And Restore Form Cookies in Javascript
    333
  5. Access Granted
    582
  6. Greeting For The Time Of Day
    392
  7. Displays the number of pages that the users browser has displayed in its session
    661
  8. Address Book
    574
  9. Basic Date Display
    508
  10. Javascript implemented Calendar
    420
  11. Javascript based Alarm Clock
    659
  12. How to record visitor's name by Cookie
    410
  13. How to get date time in Javascript ?
    497
  14. Hiding HTML on the browser
    457
  15. Getting WebSearchers On Your Site
    372
  16. Javascript Mouse Event Handler Example
    403
  17. Select And Deselect All Checkboxes By Javascript
    630
  18. Javascript & Cookie based Visitor Application
    434
  19. Cross Browser Event Management Functions Using JavaScript
    608
  20. How To Read And Write A Cookie
    359
  21. Using C# With Cookies
    620
  22. Printing A Page
    376
  23. Example Of Creating Objects
    401
  24. Linking Drop Downs
    574
  25. Roman Numerals From Integers
    509
  26. Get A Print Dialog Box By Clicking A Button
    817
  27. Keyboard event detection (Key Tracker)
    1,084
  28. IsIn For Arrays
    566
  29. Confirm The Link Clicked
    628
  30. Enlarge Image
    511
  1. Select And Deselect All Checkboxes By Javascript
    630
  2. Javascript Mouse Event Handler Example
    403
  3. Getting WebSearchers On Your Site
    372
  4. Hiding HTML on the browser
    457
  5. jQuery and Function Chaining
    531
  6. How to get date time in Javascript ?
    497
  7. Javascript based Alarm Clock
    659
  8. Javascript implemented Calendar
    420
  9. Basic Date Display
    508
  10. Address Book
    574
  11. Displays the number of pages that the users browser has displayed in its session
    661
  12. Greeting For The Time Of Day
    392
  13. Access Granted
    582
  14. Cookie enabled browser checking in Javascript
    338
  15. Cookie Redirect
    491
  16. Let popup once for event dialog or something like that in Javascript
    421
  17. Save And Restore Form Cookies in Javascript
    333
  18. How to record visitor's name by Cookie
    410
  19. Javascript & Cookie based Visitor Application
    434
  20. Cross Browser Event Management Functions Using JavaScript
    608
  21. Printing A Page
    376
  22. Example Of Creating Objects
    401
  23. Linking Drop Downs
    574
  24. Roman Numerals From Integers
    509
  25. Get A Print Dialog Box By Clicking A Button
    817
  26. Keyboard event detection (Key Tracker)
    1,084
  27. IsIn For Arrays
    566
Recently updated
  1. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    27
  2. Why SPF and DKIM Are Essential for Linux Email Servers?
    24
  3. How do I create animated background for Google Meet?
    19,708
  4. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    217
  5. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    85
  6. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    153
  7. Array of arguments passed to script in PHP
    85
  8. Invalid Auction Storms in Ad Tech
    93
  9. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    197
  10. The Two Clocks of Ad Server Architecture
    63
  11. Frequency Cap Architecture Overview
    509
  12. Collecting Proof-of-Play from 100,000 Screens
    141
  13. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    280
  14. What is RedisVL?
    105
  15. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    224
  16. TPU & GPU Cluster Management Tools
    232
  17. The Concept of Scaffolding in AI Agents
    221
  18. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    575
  19. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    252
  20. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    326
  21. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    197
  22. Machine Learning: Training vs. Ranking
    213
  23. The Continuous Learning Machine: Designing a Loop That Actually Turns
    217
  24. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    189
  25. Designing a Data Curation System Around a Vector Database
    215
  26. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    229
  27. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    649
  28. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    185
  29. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    207
  30. Understanding Data Lineage
    252