Use JS to pass information between pages on the server
Message Sending page index.html:
1 <!DOCTYPE HTML>2 <HTML>3 4 <Head>5 <MetaCharSet= "Utf-8" />6 <title></title>7 </Head>8 9 <Body>Ten <inputtype= "text"name= "MSG"ID= "MSG"value="" /> One <Buttononclick= "Send ()">Send</Button> A <DivID= "Show"> - - </Div> the <!-- - - - Description: Cross-document communication, corresponding unsafe + - - <Scripttype= "Text/javascript"> + /*each time a new window is constructed, the message is sent only to the newly constructed form, possibly because the relationship is overwritten, and the old form does not have messages*/ A varTargetwin; at varSend= function() { - //var targetwin = new Window (' http://127.0.0.1:8020/PostMessage/demo.html '); - /*is still re-opened to reconstruct, passing information only to the new window*/ - Targetwin=window.open ('http://127.0.0.1:8020/PostMessage/demo.html', '_blank', 'width=400,height=300'); - Targetwin.onload= function() { - targetwin.postmessage (document.getElementById ('msg'). Value,'Http://127.0.0.1:8020/PostMessage'); in } - } to Window.onmessage= function(event) { + if(Event.origin!= 'http://127.0.0.1:8020') { - return; the } * varShow=document.getElementById ('Show'); $ show.innerhtml+=(Event.origin+ 'The message came:' +Event.data+ '<br/>');Panax Notoginseng } - </Script> the + </Body> A the </HTML>
Information Receive page demo.html
1 <!DOCTYPE HTML>2 <HTML>3 <Head>4 <MetaCharSet= "UTF-8">5 <title></title>6 </Head>7 <Body>8 <Scripttype= "Text/javascript">9 Window.onmessage= function(Event)Ten { One if(Event.origin!= 'http://127.0.0.1:8020'){ A return; - } - Document.body.innerHTML=(Event.origin+'The message came:'+event.data); the Event.source.postMessage ('callback message, here is'+ This. Location,event.origin); - } - </Script> - </Body> + </HTML>
HTML5 two page delivery information