<a> tag redirect with setting local Storage onclick event

时间:2019-05-15 08:41:49

标签: javascript html local-storage

I have a link on which I'm redirecting to my site...the thing is that I want to set localStorage value while directing to my site. How is it possible?

I tried doing following:

<a href="new-link" 
          data-fajax="false" 
          onClick="localStorage.setItem('key','value')"
          data-transition="slidefade">Testing</a>

But failed. I want to set the key value pair in target link but it sets on the page where this link is

0 个答案:

没有答案