Advertisement
Guest User

Untitled

a guest
Aug 21st, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.33 KB | None | 0 0
  1. ============================================================
  2. Файл xxx.ru/index.php:
  3. ============================================================
  4.  
  5. <html><head>
  6. <script src="//st.astr.ru/js/easyXDM.min.js"></script>
  7. </head><body>
  8.  
  9. <script type="text/javascript">
  10.  
  11. var socket = new easyXDM.Socket({
  12.     onMessage:function(message, origin) {
  13.         //alert("Received '" + message + "' from '" + origin + "'");
  14.         if (origin == 'http://yyy.ru') {
  15.             alert(message);
  16.         }
  17.         socket.postMessage("hello world");
  18.     }
  19. });
  20.  
  21. function wo() {
  22.     window.open("http://yyy.ru.ru/check_auth.php", "", "width=500, height=400");
  23. }
  24.  
  25. </script>
  26.  
  27. <a onclick="wo()" href="#">Авторизация</a>
  28.  
  29. </body></html>
  30.  
  31.  
  32. ============================================================
  33. Файл yyy.ru/check_auth.php:
  34. ============================================================
  35.  
  36. <html><head>
  37. <script src="//st.astr.ru/js/easyXDM.min.js"></script>
  38. </head><body>
  39.  
  40. <script type="text/javascript">
  41.  
  42. var socket = new easyXDM.Socket({
  43.     remote: "http://xxx.ru/index.php", // the path to the provider
  44.         onMessage: function(message, origin){
  45.             alert("Received '" + message + "' from '" + origin + "'");
  46.         },
  47.         onReady: function() {
  48.             socket.postMessage("Yay, it works!");
  49.         }
  50. });
  51.  
  52. //window.close();
  53.  
  54. </script>
  55.  
  56. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement