In this post I am gonna show you how to create your own free Webpage hit counter for your website. Many of newbies or website developer use hit counter available on internet provided by some website,But It slows down your page loading. Hit counter created using "localStorage" in javascript is far better than cookies or any ready made counter. Count will increase even if you close browser window and next time you refresh page
Copy the code given below into script tag and refresh the page to count:
if (localStorage.pagecount)
{
localStorage.pagecount=Number(localStorage.pagecount) +1;
}
else
{
localStorage.pagecount=1;
}
document.write("Visits: " + localStorage.pagecount + " time(s).");
If you want to count page view for session of your browsing you can use "sessionStorage". It will increase count until you close your browser.
Copy the code given below into script tag and refresh the page to count:
if (sessionStorage.clickcount)
{
sessionStorage.clickcount=Number(sessionStorage.clickcount)+1;
}
else
{
sessionStorage.clickcount=1;
}
document.write("You have clicked the button " +
sessionStorage.clickcount + " time(s) in this session.");
Was this Information helpful?
Yes NoRelated Post(s):
- 3 Things you should Change in Blogger to make your Blog SEO friendly
- Using Templates in Django | Python in Web development - Part 3
- Using HTML5 Web Worker: Introducing Multithreading in JavaScript
- How create Web application with OpenShift using Eclipse
- How to Include Your Website in Google Search Result
- How to Install MongoDB (NoSQL database) on Windows 7?
Thanks a lot.
ReplyDeleteThis was very usefull information.
:D :D :D
It's an amazing piece of writing designed for all the internet
ReplyDeletevisitors; they will obtain advantage from it I am sure.
Also visit my blog - Hosting Sites
great help. Thanks for sharing :)
ReplyDeletegreat :))
ReplyDeleteCool!
ReplyDeleteGood
ReplyDeletegreat
ReplyDeletevery helpful
ReplyDeletethank you, dude!!!! you are awesome!
ReplyDeleteThanks a lot for posting this post, Your post has always been an informative source for me.
ReplyDeleteIndustrial Timing Belt Manufacturers in india
شركة مكافحة حشرات بالدمام
ReplyDeleteشركة مكافحة حشرات بالطائف
شركة مكافحة حشرات بالرياض
شركة مكافحة حشرات بنجران
ReplyDeleteشركة مكافحة حشرات بجازان
شركة مكافحة حشرات بابها
شركة مكافحة حشرات بالقصيم
ReplyDeleteشركة مكافحة حشرات بينبع
شركة مكافحة حشرات بالخرج
The blog was absolutely fantastic! Lots of great information . Keep updating the blog.
ReplyDeleteHire Affordable Xamarin Developer
Xamarin Developers in Frisco
As a Newbie, I am always searching online for articles that can help me. Thank you webpage
ReplyDeleteThis is great! Thanks!
ReplyDelete