angiemaunz / html5security

Automatically exported from code.google.com/p/html5security
1 stars 0 forks source link

html5sec.org requires DOM Storage #6

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The contents of http://html5sec.org/ are not displayed, if user disabled DOM 
Storage of the browser. 
I want you to write the purport required DOM Storage for user who disabled 
that. 

Original issue reported on code.google.com by 0xbadfca11 on 17 Feb 2012 at 3:39

GoogleCodeExporter commented 8 years ago
I would propose the following patch:

### Eclipse Workspace Patch 1.0
#P HTML5 Security Cheatsheet
Index: html/scripts/import.js
===================================================================
--- html/scripts/import.js  (Revision 532)
+++ html/scripts/import.js  (Arbeitskopie)
@@ -18,13 +18,15 @@
                 payloads = store.payloads;
                 $('#offline').show();
             }; 
-            if(navigator.onLine) {
-                localStorage[location.hostname]=JSON.stringify(
-                    {'items':items,'payloads':payloads,'categories':categories}
-                );
-                $(window).bind('offline', offline);
-                $(window).bind('online', function(){$('#offline').hide()})
-                $('#offline').hide();
+            if(navigator.onLine || typeof navigator.onLine === 'undefined') {
+               try {
+                   localStorage[location.hostname]=JSON.stringify(
+                       
{'items':items,'payloads':payloads,'categories':categories}
+                   );
+                   $(window).bind('offline', offline);
+                   $(window).bind('online', function(){$('#offline').hide()})
+                   $('#offline').hide();
+               } catch(e){}
             } else {
                 offline();
             }   

Could you please have a look if this works for you?

Original comment by Mario.He...@googlemail.com on 26 Jun 2012 at 7:07