I have two webresource one is based on React and another one is normal Html both will load on load of the form in Modern Driven App. I want to pass data between these Web Resources based on some events.
How can i achieve this?
I have two webresource one is based on React and another one is normal Html both will load on load of the form in Modern Driven App. I want to pass data between these Web Resources based on some events.
How can i achieve this?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jithu ThomasPosted Jun 21, 2024, 7:04 PM
Using the following ways it is possible: -
1. Using window.postMessage
window.postMessage is a method that allows you to send messages between different windows (or iframes) regardless of their origin. This is one of the most common ways to handle communication between different web resources.
2. Using Local Storage Events
You can use the localStorage API to pass data between the web resources. When the storage event is fired, it notifies other windows or iframes that the data has changed.
3. Using Custom Events
Custom events can also be used to communicate between different parts of your application.
Example Implimentations: -
1. Using window.postMessage
HTML Web Resource
React Web Resource
2. Using Local Storage Events: -
React Web Resource
3. Using Custom Events
HTML Web Resource
React Web Resource
Also note that, 3ach of these methods has its own advantages and use cases, so you can choose the one that best fits your application's requirements.