about
08/09/2024
WebDev MsgRcvr
WebDev Code

WebDev MsgRcvr

demo iframe child for JavaScript messaging

1.0 Message Demonstration

This page, WebDev_MsgRcvr.html, is loaded into an iframe in WebDev_MsgSndr.html. The two pages send messages back and forth to demonstrate how JavaScript messaging works.

1.1 'sections' Message

This page reponds to a message "sections" by toggeling display of a bottom menu page listing all the sections in this page. Click the "Send Message 'sections'" button to see that happen.

1.2 'request' Message

It also responds to a message "request" by sending back its url in a reply message. If you click that button you will see the display change from "No Reply" to "Received Reply"

2.0 Actions

The actions, cited above, are implemented this way:
  • When a "sections" message arrives, the onmessage(event) handler invokes JavaScript method bottomMenu.sections() which toggles the display of page-sections markup.
  • When a "request" message arrives, it posts back its url to the WebDev_MsgSndr sender.
That's all this page does to support this demonstration. All the code for this is shown in the code blocks below this iframe.
  Next Prev Pages Sections About Keys