0

I have an application where one or more tabs pass "display requests" (i.e. to display data relevant to some data query) to a dedicated tab. That tab is launched using a known window name and the initial HTML written to it using win.document.write calls. The request data is passed to it using localStorage and that dedicated tab listens for associated storage events.

This all works fine, even when running using a local-file protocol (file:///), ... except in IE11. I have a committent to support IE11 (I don't care about older versions), and the local-file scenario is used by my customers before deploying their working configurations to their websites.

My question is whether there's a reliable alternative mechanism that I can fall back to with IE11 when using file:///.

My library code has provision for a fall-back mechanism if localStorage is undefined, but it seems that everything fails. I have tried cookies (obviously using a different type of "nudge" than storage events) and postMessage, but all have fallen foul of poorly-documented IE limitations.

My data requests are not of a fixed size but I could happily justify a limitation to about 1K if necessary. Any suggestions for how to pass such textual data would be very welcome.

[UPDATE: I have tried directly manipulating data in the other window object, but it really needs a user-defined (or innocuous) event for synchronisation. Most people would recommend storage or message events for that but then I'd be back with the same problem. I have also tried using URL fragments, which at least has its own hashchanged event, but there are size limits that depend on the user's browser and are not documented in most cases.]

ACProctor
  • 284
  • 2
  • 17
  • [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage#description) data is specific to the protocol of the document. As far as I know, IE don't support localStorage object if there is no server. So I think your needs cannot be implemented. – Xudong Peng Nov 12 '21 at 10:05
  • I know it's not supported in IE, but it works everywhere else, including with file://. It does not require a server . That's why I'm looking for an alternative "fallback" mechanism – ACProctor Nov 12 '21 at 10:54
  • The answer here from 13 June 2017 is really helpful in making use of URL fragments: https://stackoverflow.com/questions/16247162/max-size-of-location-hash-in-browser – ACProctor Nov 18 '21 at 14:05

0 Answers0