Tutorial :Is site first item in history?



Question:

How to find out if site is the first item in history? This doesn't work because of security reasons:

if(window.history.item(0)==window.location.href)  


Solution:1

For security reasons the History object doesn't allow the non-privileged code to access the URLs of other pages in the session history, but it does allow it to navigate the session history.

From: Mozilla Developer Center: window.history


Solution:2

You cannot.

The users' browser history is private information and cannot be read using Javascript.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »