Skip to content

Instantly share code, notes, and snippets.

View AdReVice's full-sized avatar
🏠
Working from home

Manish joshi AdReVice

🏠
Working from home
  • Yamaha Motors Solution (I) Pvt Ltd.
  • Gaziabad
  • X @adrevice
View GitHub Profile
@AdReVice
AdReVice / storagePolyfill.js
Created July 6, 2016 10:19 — forked from hasdavidc/storagePolyfill.js
A LocalStorage polyfill that also works in private browsing Safari (by doing window.localStorage.__proto__ = ourPolyfillObject) (where window.localStorage !== 'undefined', but has a quota of 0 and throws an error when you try to setItem)
//variant of https://gist.github.com/Contra/6368485
(function () {
var isStorageAvailable = function (storage) {
if (typeof storage == 'undefined') return false;
try { // hack for safari incognito
storage.setItem("storage", "");
storage.getItem("storage");
storage.removeItem("storage");
/* VT100 terminal reset (<ESC>c) */
console.log('\033c');
/* numbers comparations */
> '2' == 2
true
> '2' === 2