title: Why Cookies.js working fine on localhost but not on server?
body: <p>First I added localStorage to store user data locally it worked fine on localhost but not on the server. I tried all ways but failed. Then I used Cookies.js JavaScript Cookies API to store user information as a cookie. Now I am getting the same issue as it was with localStorage. Cookies and localStorage both are not working on server but working fine on localhost. Please help! Everything is fine on localhost. But on the server side, I am having the issue. There is not error in console when I try on the server.</p>
  
  <p>Additionally, I am using CloudFlare. I turn it off for development. But results are the same.</p>
  
  <p><strong>Here is my Javascript code:</strong></p>
  
  <pre><code> if ($BODY.hasClass('nav-md')) {
          $SIDEBAR_MENU.find('li.active ul').hide();
          $SIDEBAR_MENU.find('li.active').addClass('active-sm').removeClass('active');
          Cookies.set('manu', 'mini', { expires: 90 });
      } else {
          $SIDEBAR_MENU.find('li.active-sm ul').show();
          $SIDEBAR_MENU.find('li.active-
  sm').addClass('active').removeClass('active-sm');
          Cookies.set('manu', 'large', { expires: 90 });
      }
  </code></pre>
  
  <p><strong>Here is script in HTML</strong></p>
  
  <pre><code> &lt;script&gt;
      var menu = Cookies.get('manu');
      if (menu === 'mini') {
          $("body").addClass('nav-sm');
  
      } else {
          $("body").addClass('nav-md');
      }
  &lt;/script&gt;
  </code></pre>