I am tracking user way throught the web dynamicly. Last 5 visited pages are showed as Breadcrumb navigation like this:
DogDatabase >> DogName >> UserName >> KennelName >> DogName >> etc....
Its dynamicly generated path of the visited pages... This script is in PHP and it works very well.
Now i am using SESSIONs to move that array of visited pages to another page. Also tried LocalStorage in JS.
My problem is, if the user has more windows of my web. The array is shared for all instances (windows) of my web for 1 user.
So it looks like this:
w1 - widnow 1
w2 - window 2
w1.DogDatabase >> w1.DogName >> w2.UserName >> w1.KennelName >> w2.DogName
But i want it like this:
w1.DogDatabase >> w1.DogName >> w1.KennelName
w2.UserName >> w2.DogName
My question is: How to move array of visited pages to another page to be specific for each window of my web for 1 user in PHP or JS?
Thank you, Andrew
EDIT - !SOLVED! :
So i have done the breadcrumb navigation :)
i have multidimensional array like this:
array (
[0] : (nameOfPage,pageURL)
[1] : (nameOfPage,pageURL)
etc..
)
I used sessionStorage for get this array to another page. Awesome is, the sessionStorage is unique for each window/tab of the web, so i dont need identify the window/tab. When the window/tab is closed, storage is cleared. Next good feature is when the user click on BACK button, sessionStorage is going back to the hystorical value on that page. When the page is reopend from browser wia closed pannels function, sharedStorage is on current value too. So its amazing.
For saving array into sessionStorage:
sessionStorage.setItem(key, JSON.stringify(myarray));
For reading array from sessionStorage:
var myarray = JSON.parse(sessionStorage.getItem(key));
variable key is name:
var key = 'navigation';