{"id":47347,"library":"cross-storage","title":"cross-storage","description":"Cross domain local storage library enabling multiple browser windows/tabs across different domains to share a single localStorage. Provides an API using ES6 promises. Version 1.0.0 is the latest stable release (in maintenance mode). Differentiators: alternative to cookies with larger storage (up to 2.49M chars), avoids request header overhead. Uses hub/client architecture with iframe postMessage communication, enforced origin permissions via RegExp patterns.","status":"maintenance","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/zendesk/cross-storage","tags":["javascript","local","storage","cross","domain"],"install":[{"cmd":"npm install cross-storage","lang":"bash","label":"npm"},{"cmd":"yarn add cross-storage","lang":"bash","label":"yarn"},{"cmd":"pnpm add cross-storage","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Named export, not default. Also available via require.","wrong":"import CrossStorageClient from 'cross-storage'","symbol":"CrossStorageClient","correct":"import { CrossStorageClient } from 'cross-storage'"},{"note":"Named export; CommonJS require works but ESM preferred.","wrong":"const CrossStorageHub = require('cross-storage').CrossStorageHub","symbol":"CrossStorageHub","correct":"import { CrossStorageHub } from 'cross-storage'"},{"note":"Requires destructuring, not default export.","wrong":"const CrossStorageClient = require('cross-storage')","symbol":"CrossStorageClient","correct":"const { CrossStorageClient } = require('cross-storage')"}],"quickstart":{"code":"// Hub: serve this script on https://store.example.com/hub.html\nCrossStorageHub.init([\n  {origin: /\\.example\\.com$/, allow: ['get']},\n  {origin: /:\\/\\/(www\\.)?example\\.com$/, allow: ['get', 'set', 'del']}\n]);\n\n// Client\nvar storage = new CrossStorageClient('https://store.example.com/hub.html');\nstorage.onConnect().then(function() {\n  return storage.set('key', 'value');\n}).then(function() {\n  return storage.get('key');\n}).then(function(val) {\n  console.log(val);\n}).catch(function(err) {\n  console.error(err);\n});","lang":"javascript","description":"Initialize hub with permissions, then create a client, connect, set, and get a value."},"warnings":[{"fix":"Ensure hub URL uses same protocol (HTTP vs HTTPS) as client page.","message":"CORS and iframe same-origin policy: Hub and client must be served over HTTPS if parent page is HTTPS, else messages blocked.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use patterns like /\\.example\\.com$/ to prevent origin spoofing.","message":"Permissions RegExp must match origin exactly; trailing $ required to avoid matching malicious subdomains.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider alternatives like postMessage-based libraries or iframe storage solutions.","message":"library is no longer actively maintained; no bug fixes or security patches since 2016.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.0':28 '2.49':46 'across':13 'altern':38 'api':23 'architectur':55 'avoid':49 'browser':11 'char':48 'communic':59 'cooki':40 'cross':2,4,69 'cross-storag':1 'differ':14 'differenti':37 'domain':5,15,70 'enabl':9 'enforc':60 'es6':25 'header':51 'hub/client':54 'ifram':57 'javascript':66 'larger':42 'latest':31 'librari':8 'local':6,67 'localstorag':20 'm':47 'mainten':35 'mode':36 'multipl':10 'origin':61 'overhead':52 'pattern':65 'permiss':62 'postmessag':58 'promis':26 'provid':21 'regexp':64 'releas':33 'request':50 'share':17 'singl':19 'stabl':32 'storag':3,7,43,68 'use':24,53 'version':27 'via':63 'windows/tabs':12","created_at":"2026-06-07T16:51:03.516725+00:00","updated_at":"2026-06-07T16:51:03.516725+00:00","problems":[{"fix":"Use `import { CrossStorageClient } from 'cross-storage'`.","cause":"Importing default instead of named export.","error":"CrossStorageClient is not a constructor"},{"fix":"Host hub.html on the same origin as specified in permissions; ensure CORS headers if necessary.","cause":"Hub and client different origins, or hub not served correctly.","error":"Uncaught DOMException: Blocked a frame with origin \"http://client.example.com\" from accessing a cross-origin frame."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/zendesk/cross-storage","github":"https://github.com/zendesk/cross-storage","docs":null,"changelog":null,"pypi":null,"npm":"cross-storage","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}