Solved

How to remember the last website I visited

Posted on 2004-09-14
10
297 Views
Last Modified: 2011-09-20
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
Comment
Question by:mingchih
  • 4
  • 4
  • 2
10 Comments
 
LVL 33

Expert Comment

by:sajuks
ID: 12052644
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
 
LVL 5

Expert Comment

by:webtrans
ID: 12052648
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
 

Author Comment

by:mingchih
ID: 12052651
i would like JS. or ASP ? what is the difference ?

thanks
0
 
LVL 5

Expert Comment

by:webtrans
ID: 12052660
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
 

Author Comment

by:mingchih
ID: 12052730
I am not very good at it, could you kindly provide a sample script ?

thanks
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 33

Accepted Solution

by:
sajuks earned 500 total points
ID: 12052737
0
 

Author Comment

by:mingchih
ID: 12052745
this is great, thanks
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12052754
Thanks for the points and grade.
0
 

Author Comment

by:mingchih
ID: 12052793
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
 
LVL 33

Expert Comment

by:sajuks
ID: 12052850
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

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now