File tree Expand file tree Collapse file tree 1 file changed +16
-15
lines changed
Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Original file line number Diff line number Diff line change 1+ < script >
2+ var counterContainer = document . querySelector ( ".website-counter" ) ;
3+ var visitCount = localStorage . getItem ( "page_view" ) ;
4+
5+ // Check if page_view entry is present
6+ if ( visitCount ) {
7+ visitCount = Number ( visitCount ) + 1 ;
8+ localStorage . setItem ( "page_view" , visitCount ) ;
9+ document . cookie = 'VisitorCount=' + visitCount + '; expires=Wed, 1 Jan 2070 13:47:11 UTC; path=/' ;
10+ } else {
11+ visitCount = 1 ;
12+ localStorage . setItem ( "page_view" , 1 ) ;
13+ }
14+ counterContainer . innerHTML = visitCount ;
15+ </ script >
16+
117< h1 > yo</ h1 > < h1 > yo</ h1 > < h1 > yo</ h1 > < h1 > yo</ h1 > < h1 > yo</ h1 > < h1 > yo</ h1 >
218< h1 > < script >
319 let CookieListAll = document . cookie ;
@@ -56,18 +72,3 @@ <h1><script>
5672location . reload ( ) ;
5773} ;
5874</ script >
59- < script >
60- var counterContainer = document . querySelector ( ".website-counter" ) ;
61- var visitCount = localStorage . getItem ( "page_view" ) ;
62-
63- // Check if page_view entry is present
64- if ( visitCount ) {
65- visitCount = Number ( visitCount ) + 1 ;
66- localStorage . setItem ( "page_view" , visitCount ) ;
67- document . cookie = 'VisitorCount=' + visitCount + '; expires=Wed, 1 Jan 2070 13:47:11 UTC; path=/' ;
68- } else {
69- visitCount = 1 ;
70- localStorage . setItem ( "page_view" , 1 ) ;
71- }
72- counterContainer . innerHTML = visitCount ;
73- </ script >
You can’t perform that action at this time.
0 commit comments