+ 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
2 ответов
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
- 2
I don't really understand,please message me directly or give me an example