When i trying to store value in Local Store means in browser then I have got Good solution by using $.Cookie. But when I Have started to work with it then its working fine in with Mozilla and IE. But when I have started to work in chrome then I have got problem to set and get Cookie through $.cookie. Then I have got a very good solution to Store cookie value in Local Browser by Using jquery.Storage.js($.Storage) and Its solved my problem with ease.
Code :
<script src="js/jquery-1.9.1.js" language="javascript" type="text/javascript"></script>
<script src="js/jquery.cookie.js" language="javascript" type="text/javascript"></script>
<script src="js/jquery.Storage.js" language="javascript" type="text/javascript"></script>
var isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
//get cookies
var Flag=(isChrome)?$.Storage.get("Flag"):$.cookies.get("Flag");
//set cookies
if(isChrome)$.Storage.set("Flag", "1");else $.cookies.set("Flag", "1");
<script src="js/jquery.cookie.js" language="javascript" type="text/javascript"></script>
<script src="js/jquery.Storage.js" language="javascript" type="text/javascript"></script>
var isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
//get cookies
var Flag=(isChrome)?$.Storage.get("Flag"):$.cookies.get("Flag");
//set cookies
if(isChrome)$.Storage.set("Flag", "1");else $.cookies.set("Flag", "1");
No comments:
Post a Comment