After i finished the mobile version of my website i used the https://github.com/sebarmeli/JS-Redirection-Mobile-Site to make the redirection to mobile site and also the redirection to the full site. Also i am using the cookie function to save the state for 1 hour using the code bellow:
<script>
SA.redirection_mobile ({
noredirection_param : "noredirection",
mobile_prefix : "m",
cookie_hours : "1"
});
</script>
The problem that i have is that i use subdomains in my site and when i came back to full site if i click to a link for example news.site.com/cat1/news1 or video.site.com/video1 the redirection goes back to mobile site because cookie is created for http://www.site.com site the redirection is http://www.site.com/noredirection=true.
Any idea how to solve this?
The issue is pretty easy to fix if you set the cookie yourself without the www. Setting the domain for the cookie as .site.com would allow for any subdomain.Take a look at this stack answer.
You might be able to modify the script your using, or just setting the cookie manually.