| <html> | |
| <head> | |
| <style> | |
| iframe { border: 0px; } | |
| html, #app { | |
| height: 100%; | |
| overflow: hidden; | |
| } | |
| html body, #app { | |
| position: absolute; | |
| top: 0; | |
| bottom: 0; | |
| right: 0; | |
| left: 0; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div id='app'> | |
| <iframe id='frame' width="100%" height="100%" frameborder="0" src=""></iframe> | |
| </div> | |
| <script> | |
| var basepath='https://baidu.com/'; | |
| function getUrl(){ | |
| var hash = location.hash?location.hash.slice(1):''; | |
| return basepath+hash; | |
| } | |
| var frame=document.getElementById('frame'); | |
| frame.setAttribute('src', getUrl()) | |
| addEventListener('message',function(message){ | |
| console.log(message); | |
| message = message.data; | |
| location.hash='#'+message.slice(basepath.length) | |
| }) | |
| </script> | |
| </body> | |
| </html> | |