Scenario
On my website I have links to "contactus.html" page on every single page's menu ( the usual Services, About Us, Contact Us menu) , and each page is made using a dreamweaver template and the menu is only editable in the .dwt template file itself itself .
When the user visits the "index.html" the first time a cookie , called "client-location" is placed with the client's location.
The Desired Outcome:
When the client clicks the Contact Us menu item, I would like to read the client-location cookie and send the user to the right contact page, e.g. contactus2.html or contactus3.html.
I got this from the stackoverflow answer in the link below . Something like this will go in the script.js file
{
document.getElementById("contactlink").onclick = function() {
var clientlocation = readCookie(); // this returns contact1.html, a weblink
document.getElementById("contactlink").href=clientlocation;
}
Possible Issue:
It is entirely possible that the user, when he/she visits the site the first time goes straight to , say About Us section, and the cookie won't be placed to mention their location at all. In that case I would like to go to contatus1.html , which is a generic contact us page.
And what if the javascript is disabled, then the browser won't even go anywhere upon a click.
I read up online and checked this How to change href of <a> tag on button click through javascript as well, but I am wondering if a) there will be any accessibility issues b) if that is a good approach