set-token.html 414 B

123456789101112131415
  1. <script>
  2. // iframe接收消息
  3. window.addEventListener('message', function(e) {
  4. if (e.source != window.parent) {
  5. return;
  6. }
  7. var storeKey = 'app-state-session';
  8. if (e.data) {
  9. sessionStorage.setItem(storeKey, e.data);
  10. } else {
  11. sessionStorage.removeItem(storeKey);
  12. }
  13. window.parent.postMessage("success", "*");
  14. });
  15. </script>