Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 655 Vote(s) - 3.51 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cookies aren't getting read with Javascript

#1
I have embedded a 'Desktop View' link into my mobile webpage then a 'Mobile View' link on the desktop link if the user wishes to reverse their decision.

I have added the javascript to remove the CSS that would style the page in mobile view when the 'Desktop View' link is clicked and the cookie is being set as per normal. The problem is I'm using a boolean to check to see if the cookie is present when the user decides to switch back and forth between desktop and mobile views and it doesn't seem to be working. I have set up Console.Log to show when certain aspects are functioning and it appears that the check to see if the cookie is already present is being overlooked, its just setting a new cookie everytime and if the user clicks on a navigation link on the desktop view then goes back it reverts straight back to mobile view instead of the desktop view which is a result of the cookie not being read.

window.addEvent('domready', function () {
if ($('FooterDesktopView')){

console.log("desktopagain");

var windowcookie = getCookie('NonResponsiveVersion');
if (windowcookie == true){

removejscssfile("//static.uk-plc.net/library-cms/abd/bab95b16-20ba-4090-b883-1bee04bc58fc.css", "css");
$$('.remove-css').addClass('displaynone');
$$('.load-css').removeClass('displaynone');

}
else {

$$('.remove-css').each(function (el) {
el.addEvent('click', function () {

console.log("desktop");

removejscssfile("//static.uk-plc.net/library-cms/abd/bab95b16-20ba-4090-b883-1bee04bc58fc.css", "css");
$$('.remove-css').addClass('displaynone');
$$('.load-css').removeClass('displaynone');

setCookie('NonResponsiveVersion', 'desktop', '1');
});
});
}
}
});

Using the Console.log I'm finding that this section is being overlooked

console.log("desktopagain");

var windowcookie = getCookie('NonResponsiveVersion');
if (windowcookie == true){

removejscssfile("//static.uk-plc.net/library-cms/abd/bab95b16-20ba-4090-b883-1bee04bc58fc.css", "css");
$$('.remove-css').addClass('displaynone');
$$('.load-css').removeClass('displaynone');

}
else {

I should mention I'm using a CMS and Mootools. Can anybody help me resolve this problem?
Reply



Forum Jump:


Users browsing this thread:
2 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through