; PageMessage Example ; ------------------- Graphics 640,480,0,2 SetBuffer BackBuffer() received=0 latest$="(none yet)" While Not KeyDown(1) ; Take every message the page has sent since the last frame message=PageMessage() While message<>0 received=received+1 ; Each message is a JSON value: keep it as text to show it latest=JsonStringify(message,0) FreeJson message message=PageMessage() Wend Cls Text 0,0,"Waiting for messages from the web page Esc: exit" Text 0,20,"Messages received: "+received Text 0,40,"Latest message: "+latest If received=0 Then Text 0,80,"A page that runs this program in a frame can send it messages." Text 0,100,"On Windows and macOS there is no page, so PageMessage returns 0." EndIf Flip Wend End