Skip to main content

Hi there,

 

I’m trying to use a conditional statement that checks for 

  • navigator.useragent
  • sessionStorage.get(‘some item’)
  • localStorage.get(‘some item’)

E.g. {% if localStorage.get('some-item') != undefined  %}

<div>Some div</div>

{% else %}

<div>Some other div</div>

{% endif %}  

 

When I preview the page, this doesn’t seem to do what I intend. E.g. if there is no localStorage with that key, it still shows “Some div”

Join the Community or User Group to Participate in this Discussion

Reply