1

I am trying to understand the features of the localStorage. Suppose, I am storing large json via localStorage. I want the stored data to be shown to the testing team. If I display the stored data in a HTML page and then send the link to the testing team then they will see null, as localstorage stores data locally. The data is too large to copy/paste in a .txtfile. Is there any way of displaying localStorage data, so that it can viewed by others remotely?

user227666
  • 734
  • 2
  • 18
  • 34
  • 2
    Not quite sure what you're asking, but it is possible to `POST` the data from the client to a remote, shared service. – jensgram Jan 22 '14 at 12:57
  • 1
    localStorage is like a cookie. though , it's not transmit with every request. it's a local db. from here - the sky are the limit – Royi Namir Jan 22 '14 at 12:58
  • First of all HTML5's localStorage databases are size-limited standard sizes are 5 or 10 MB per domain. Secondyl as @jensgram said you should post the data from client to a remote – semirturgay Jan 22 '14 at 13:04
  • @sMr I know the localStorage size limits. Am more interested in knowing a solution that will help me to view data remotely (apart from my local machine). – user227666 Jan 22 '14 at 13:06

2 Answers2

-1

The clue is in the name - local storage is local.

There is a work around in that you use iframes and the postMessage API to access localStorage from an external domain.

Is it possible to use HTML5 local storage to share data between pages from different sites?

Community
  • 1
  • 1
James Hibbard
  • 16,490
  • 14
  • 62
  • 74
  • The questioner is trying to view it remotely. There is NO work-around for that. The hack you link to is still only for the local machine, just for different domains. – Nathan Bubna Jan 28 '14 at 16:30
-1

As Jack Zelig points out, localStorage is local. But it is not only local to the domain but also to the particular browser on the particular machine. You cannot share it between browsers nor between devices. There is no work-around for that. To show it to remote people, you MUST be storing it or sending it through a server to which both devices/browsers are connected, at which point localStorage is irrelevant.

Think of localStorage as a new, improved version of cookies.

Nathan Bubna
  • 6,823
  • 2
  • 35
  • 36