I am developping a client side web application with jquery
I want to store all visited pages, I use cookie for it
So, I have two element to store:
- page URL
- page title
I start creation of data in cookie as :
Index.html :
if(!$.cookie("history")){
var url_history = document.location;
var title_history = $("html title").text();
$.cookie("historyURL", url_history);
$.cookie("historyTITLE", title_history);
}
anotherPage.html :
var url_history = document.location;
var title_history = $("html title").text();
$.cookie("historyURL", url_history);
$.cookie("historyTITLE", title_history);
Problem is that cookie's new value overwrites the old.
I think I should set an object, not string such as:
var objHistory = [];
objHistory.push({url:document.location, title: $("html title").text()})
$.cookie("history", objHistory);
Now I have another problem:
I can't retrieve My Object from cookie
When I am trying to get my Object from cookie, It shows a string "object" not Object
Is it possible to set an object in cookie?
thank for your help