tableau / extensions-api

Extensions API sample code and developer docs.
http://tableau.github.io/extensions-api
MIT License
268 stars 251 forks source link

Localstorage #369

Closed henryyyleung closed 3 years ago

henryyyleung commented 3 years ago

Will localstorage work in Tableau extension? I try to persist values in localstorage in extensions but when i try to read it from another html in the location using chrome it ia empty

johnDance commented 3 years ago

Hi @henryyyleung, local storage became supported in 2020.4. On Tableau desktop, storage persists until Tableau desktop is closed. If you need something persistent, we recommend extension settings. John

henryyyleung commented 3 years ago

Thanks John. Could u please advise how this cam be done thru extension settings?

johnDance commented 3 years ago

I might have misunderstood your first question. Settings are persistent, but specific to a single extension. They are saved in the workbook, and are available to both the main extension, and the configuration. https://tableau.github.io/extensions-api/docs/interfaces/settings.html

If you want to share data between two different extensions, and have it persist through closing Tableau desktop, we do not have any official support for that. Of course it is persistent if you are using Tableau server, since your browser handles the local storage.

If you need persistent multi-extension shared storage in Tableau desktop, can you use something server side?

John

henryyyleung commented 3 years ago

Thanks John. This will be helpful. I am trying to integrate a 3rd party js library into Tableau extension and it works so far, except for a PDF download feature which this js library provided. This PDF download function will post a JSON to an external URL and return with a blob for download. This doesn't work in Tableau desktop hence I wonder if I can somehow persist that JSON to another html and run the download function separately. I guess this feature should work under the Tableau online but I haven't had a time to try it out yet.

henryyyleung commented 3 years ago

Actually John. In short, I have the following link in the Tableau extension which I would to open up in another window. It works if I replace the href with a proper url (eg. www.google.com) but won't work for a blob object. Do you know if this is supported?
Sorry for asking such stupid question.. I am quite new to this. <a href="blob:http://localhost/f158f992-1234-0000-fdf6-5c4f1324eb20" target="_blank">Download</a>

henryyyleung commented 3 years ago

Close

WagnerOrtiz commented 2 years ago

You guys have talked about localStorage on Tableau Desktop... But actually I'm struggling with localStorage on Tableau Server. Does it accept localStorage?

Tks

johnDance commented 2 years ago

Hi @WagnerOrtiz Yes, server should handle localStorage. Tableau server isn't involved, since it is a client side mechanism. Remember that localStorage is specific to domain and protocol. Also remember that in chrome, local storage is handled like cookies. If cookies are blocked, so is local storage. You might use developer tools to see if there are errors in the console as you write or read. John