• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

How to remember the last website I visited

Hi, Experts,
I have this question, I have two websites, one is english version and another one is other language version. A user will come to my english site first, if this user want to visit the " other language" site, this user click a link to the " other language" website. How can I write a script which will remember this user's very last visit ( which is the " other language" site ) and not to my english site. Is it about cookie ?

Sincerely,
0
Brian Lin
Asked:
Brian Lin
  • 4
  • 4
  • 2
1 Solution
 
sajuksCommented:
You need a cookie to store his/her preferences.
When the user enters the url again you can read from the cookie his preference and redirect to the appropriate page
0
 
webtransCommented:
yes it would be about cookies for sure
and you can make it in JS or ASP or PHP
whatever is best for you
which would you prefer
i can send u any sample
0
 
Brian LinDesignerAuthor Commented:
i would like JS. or ASP ? what is the difference ?

thanks
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
webtransCommented:
asp would be using
response.cookies("cookiename") to write the cookie
and request.cookies("cookiename") to read the cookie
then a response.redirect to move him to the folder you like or even server.transfere
refere to this for more info
http://www.w3schools.com/asp/asp_cookies.asp
0
 
Brian LinDesignerAuthor Commented:
I am not very good at it, could you kindly provide a sample script ?

thanks
0
 
Brian LinDesignerAuthor Commented:
this is great, thanks
0
 
sajuksCommented:
Thanks for the points and grade.
0
 
Brian LinDesignerAuthor Commented:
one last Q, I saw the code
<html>
<head>
<script language="JavaScript" src="cookieLibrary.js"></script>
<script language="JavaScript">
// check to see if cookie exists
// if yes, redirect to language page
if (GetCookie("lang") == "EN")

Do I need to download "cookieLibrary.js" ?
0
 
sajuksCommented:
Yes the cookie script can be obtained from
http://www.cookiecentral.com/code/cookie.txt ( save it as the .js file )
or you can take it from
http://javascript.internet.com/cookies/name.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 4
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now