M
M
Maxim Semiletkin2020-04-22 13:33:27
JavaScript
Maxim Semiletkin, 2020-04-22 13:33:27

How to transfer data from one tab to another?

Good afternoon, ladies and gentlemen. Need help. The client has 2 tabs open in the store, one with selected products, the other with a product catalog. When you click on a product, it goes to your favorites. How can I parse the product that the client added immediately. So that when switching the tab to favorites, the client has already seen the product that he has chosen?
The work takes place with three front-end pillars. No frameworks.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Osher, 2020-04-22
@miraage

window.postMessage
websockets
localStorage events

S
Stalker_RED, 2020-04-22
@Stalker_RED

When adding a product to favorites or a shopping cart, we write in localStorage the time of such addition and information about the product.
"Favorites" listens to the storage event , and if there is a fresh label in it, it will be updated.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question