How can I display web browsing records?
Answer
For example, Xunlei looks at the Historical Views on the edge and some historical clicks on news websites. Is there any such case? Thank you.
Other solutions
Save the url and page title to cookies or sessions.
Other solutions
Write down with pen and book ....
Other solutions
Find a function implemented using JS and COOKIE on the Internet, but do not quite understand function glog (evt) // defines the function for recording the mouse click action
{
Evt = evt? Evt: window. event; var srcelemem(evt.tar get )? Evt.tar get: evt. srcElement;
Try
{
While (srcElem. parentNode & srcElem! = SrcElem. parentNode)
// Use the preceding statement to determine whether the mouse action is in the valid area and prevent invalid clicks from being recorded.
{
If (srcElem. tagName & srcElem. tagName. toUpperCase () = "A") // you can determine whether the object you click belongs to A link.
{
Linkname = srcElem. innerHTML; // retrieve the name of the event source, that is, the text between the two, that is, the Link name.
Address = srcElem. href + "_ www.achome.cn _"; // retrieve the href value of the event source, that is, the link address.
Wlink = linkname + "+" + address; // integrate the Link name and link address into a variable.
Old_info = getCookie ("history_info"); // retrieves the browsing history recorded previously from Cookies. This function is declared later.
// The following program starts to judge whether the new browsing action is duplicate with the previous six historical ones. If not, the cookies are written.
Var insert = true;
If (old_info = null) // checks whether the cookie is null.
{
Insert = true;
}
Else
{
Var old_link = old_info.split ("_ www.achome.cn _");
For (var j = 0; j <= 5; j ++)
{
If (old_link [j]. indexOf (linkname )! =-1)
Insert = false;
If (old_link [j] = "null ")
Break;
}
}
If (insert)
{
Wlink + = getCookie ("history_info ");
SetCookie ("history_info", wlink); // write cookie, which is declared later
History_show (). reload ();
Break;
}
}
SrcElem = srcElem. parentNode;
}
}
Catch (e ){}
Return true;
}
Function getCookieVal (offset ){
Var endstr = document. cookie. indexOf (";", offset );
If (endstr =-1) endstr = document. cookie. length;
Return unescape (document. cookie. substring (offset, endstr ));
}
Function getCookie (name ){
Var arg = name + "= ";
Var alen = arg. length;
Var clen = document. cookie. length;
Var I = 0;
While (I <clen ){
Var j = I + alen;
If (document. cookie. substring (I, j) = arg) return getCookieVal (j );
I = document. cookie. indexOf ("", I) + 1;
If (I = 0) break;
}
Return null;
}
// Write browsing actions into cookies
Function setCookie (name, value ){
Var exp = new Date ();
Exp. setTime (exp. getTime () + 3600000000 );
Document. cookie = name + "=" + value + "; expires =" + exp. toGMTString ();
}
Function history_show ()
{
Var history_info = getCookie ("history_info"); // retrieve the historical records in the cookie.
Var content = ""; // defines a DISPLAY variable
If (history_info! = Null)
{
History_arg = history_info.split ("_ www.achome.cn _");
Var I;
For (I = 0; I <= 5; I ++)
{
If (history_arg [I]! = "Null ")
{
Var wlink = history_arg [I]. split ("+ ");
Content + = ("plaintext" + "" + wlink [0] +"
");
}
Document. getElementById ("history"). innerHTML = content;
}
}
Else
{Document. getElementById ("history"). innerHTML = "Sorry, you have no browsing history ";}
} [/I] [/I]
Copy code
Other solutions
Marking this is useful to me.
Other solutions
Write down with pen and book ....
Yu An published on [url = http://bbs.phpchina.com/redirect.php? Goto = findpost & pid = 459164 & ptid = 64656] link mark [img] http://bbs.phpchina.com/images/common/back.gif?/img=#/url]
A good solution that has been tried and tested!
Other solutions
Damn it, now I know it's an Ancient Corpse...