I want to mimic the behavior of elpais.com for my Drupal website. It works as follows:
If you visit elpais.com and go to any section, like brasil.elpais.com, and then you close the tab/window, and then revisit elpais.com, the system automatically redirects to brasil.elpais.com. As you notice, the system saves the user last closed location.
I want to make this for Drupal website; particularly for any page.
What I have done so far is very simple:
- Added the
cookies.js
file to themisc
folder. (The code for this JavaScript file was gotten from How do I set/unset cookie with jQuery?.) - In the
page.tpl.php
file I call the file using thisdrupal_add_js('misc/cookies.js', 'file');
to embed the JavaScript code for cookies management.
I have the basic idea: Save the current URL to a cookie -using JavaScript-, and then restore it when the user visit any other page.
What do I need to perform that? Ideas, suggestions, etc.?