Javascript 如何使用jquery允许用户选择站点首选项,然后重定向到该页面/站点?

Javascript 如何使用jquery允许用户选择站点首选项,然后重定向到该页面/站点?,javascript,jquery,cookies,Javascript,Jquery,Cookies,我有一个域需要多个主页,我想让访问者选择他们的首选项,并使用JQuery在cookie中设置该首选项。我无法访问网站上的代码,因此需要使用jQuery或Javascript来完成。我不是一个程序员,但如果我有一个headstart,我可以把事情拼凑起来 更多详情: www.domain.com/home www.domain.com/home2 www.domain.com/home3 User makes a choice from the above in a pulldown menu

我有一个域需要多个主页,我想让访问者选择他们的首选项,并使用JQuery在cookie中设置该首选项。我无法访问网站上的代码,因此需要使用jQuery或Javascript来完成。我不是一个程序员,但如果我有一个headstart,我可以把事情拼凑起来

更多详情: www.domain.com/home www.domain.com/home2 www.domain.com/home3

User makes a choice from the above in a pulldown menu

Cookie is set marking their home page preference

User is redirected to their specific choice

Next time they visit www.domain.com the cookie is read and they are redirected to their preference

If no cookie exists, redirect to root or /home

我不确定如果你“无法访问网站上的代码”但“只有一个域”,你会尝试做什么,但你可能会发现这很有用


至于重定向位,请看。

我所说的“无法访问代码”的意思是——我们不能添加.asp/.php等。我们有办法将javascript/css添加到特定页面,但就是这样。我将查看您发送的链接。