Home >Web Front-end >JS Tutorial >js implementation of browsing history example_javascript skills

js implementation of browsing history example_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:51:491551browse

You must first reference a js jquery.cookie.js

1, first write jsCookied

Copy code code As follows:

//Browsing record written to JSCookied starts
var img=$("#ProductImgurl").attr("jqimg");
var name=$("# ProductDetail_ctl00_LabelName").text();
var url=location.href;
var price=$("#ProductDetail_ctl00_LabelShopPrice").text();
var sellcount=$("#ProductDetail_ctl00_lblSaleNumber"). text();
var hc=img "|" name "|" url "|" price "|" sellcount;
if($.cookie("history")!=null)
{
if($.cookie("history").indexOf(name)==-1)
{

$.cookie("history",hc "*" $.cookie("history "),{expires:8,domain:'.groupfly.com',path:"/"});
}
}
else
{
$.cookie("history ",hc,{expires:8,domain:'.groupfly.com',path:"/"});
}
//Write browsing history to JSCookied End

2. Then read Cookied
Copy code The code is as follows:


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn