Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

switch to local storage. cookie enabled. in my perf tests I don't see…

… a big improvement with this cookie
  • Loading branch information...
commit 06896b607f9efb7ecaa7bc1c2306b394f6a7ebc2 1 parent 8764410
Paul Irish paulirish authored
Showing with 7 additions and 6 deletions.
  1. +2 −1  README.txt
  2. +2 −2 modernizr-test.html
  3. +3 −3 modernizr.js
3  README.txt
View
@@ -1,4 +1,5 @@
-Modernizr � a JavaScript library allowing you to use CSS3 & HTML5 while maintaining control over unsupported browsers
+
+Modernizr - a JavaScript library allowing you to use CSS3 & HTML5 while maintaining control over unsupported browsers
Modernizr is a script that will detect native CSS3 and HTML5 features
available in the current UA and provide an object containing all
4 modernizr-test.html
View
@@ -21,7 +21,7 @@
<script>
- window.localStorage && document.write('localStorage.getItem("modernizr1.2pre") is: ' + (!!localStorage.getItem('modernizr1.2pre') ? 'PRESENT' : 'EMPTY') + '<br>');
+ window.sessionStorage && document.write('sessionStorage.getItem("modernizr1.2pre") is: ' + (!!sessionStorage.getItem('modernizr1.2pre') ? 'PRESENT' : 'EMPTY') + '<br>');
var start = +new Date();
</script>
@@ -79,7 +79,7 @@
return;
}
- window.localStorage && document.write('localStorage.getItem(modernizr'+Modernizr._version+') == ' + localStorage.getItem('modernizr'+Modernizr._version) + '<br>');
+ window.sessionStorage && document.write('sessionStorage.getItem(modernizr'+Modernizr._version+') == ' + sessionStorage.getItem('modernizr'+Modernizr._version) + '<br>');
for (var prop in Modernizr) {
if (typeof Modernizr[prop] === 'function') continue;
6 modernizr.js
View
@@ -697,9 +697,9 @@ window.Modernizr = (function(window,doc,undefined){
// CURRENTLY DISABLED COMPLETELY.
- isAgentCookieable = false && tests[localstorage]() && window.JSON && JSON.parse && JSON.stringify;
+ isAgentCookieable = tests[sessionstorage]() && window.JSON && JSON.parse && JSON.stringify;
if (isAgentCookieable){
- cookie = (cookie = localStorage.getItem( cookiestr ) ) && JSON.parse(cookie);
+ cookie = (cookie = sessionStorage.getItem( cookiestr ) ) && JSON.parse(cookie);
if (cookie) ret = cookie;
}
@@ -720,7 +720,7 @@ window.Modernizr = (function(window,doc,undefined){
// store the cookie for the first time.
if (isAgentCookieable && !cookie){
- localStorage.setItem( cookiestr , JSON.stringify(ret) );
+ sessionStorage.setItem( cookiestr , JSON.stringify(ret) );
}
Please sign in to comment.
Something went wrong with that request. Please try again.