remove-token.html 728 B

12345678910111213141516171819202122232425
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Document</title>
  8. </head>
  9. <body>
  10. <div id="app">hello</div>
  11. <script>
  12. // iframe接收消息
  13. window.addEventListener('message', function(e) {
  14. if (e.data == 'removeToken') {
  15. if (e.source != window.parent) {
  16. return;
  17. }
  18. var storeKey = 'app-state-session';
  19. localStorage.removeItem(storeKey);
  20. window.parent.postMessage("success", "*");
  21. }
  22. });
  23. </script>
  24. </body>
  25. </html>