+ 1

Hi guys,I need help with JavaScript

How can I make a .html file show that an event has taken place in another . html file with pure JavaScript

21st Mar 2021, 6:33 AM
SANNI ABDUL-AMEEN OLUWADARASIMI
2 odpowiedzi
0
you need to communicate between the two html documents... attach event listener in the watched html, on event raised transmit the information to the watching document. communication between two html document can be achieve by: 1) if same domain (and potentially same subdomains and protocols) and support of webstorage, you could save some key/value pair, listening for webstorage event then read the key/value pair https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API 2) if not, you could use the cross domain agnostic postMesage function and onmessage event... https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
21st Mar 2021, 6:53 AM
visph
visph - avatar
- 2
I don't really understand,please message me directly or give me an example
21st Mar 2021, 7:05 AM
SANNI ABDUL-AMEEN OLUWADARASIMI