Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ============================================================
- Файл xxx.ru/index.php:
- ============================================================
- <html><head>
- <script src="//st.astr.ru/js/easyXDM.min.js"></script>
- </head><body>
- <script type="text/javascript">
- var socket = new easyXDM.Socket({
- onMessage:function(message, origin) {
- //alert("Received '" + message + "' from '" + origin + "'");
- if (origin == 'http://yyy.ru') {
- alert(message);
- }
- socket.postMessage("hello world");
- }
- });
- function wo() {
- window.open("http://yyy.ru.ru/check_auth.php", "", "width=500, height=400");
- }
- </script>
- <a onclick="wo()" href="#">Авторизация</a>
- </body></html>
- ============================================================
- Файл yyy.ru/check_auth.php:
- ============================================================
- <html><head>
- <script src="//st.astr.ru/js/easyXDM.min.js"></script>
- </head><body>
- <script type="text/javascript">
- var socket = new easyXDM.Socket({
- remote: "http://xxx.ru/index.php", // the path to the provider
- onMessage: function(message, origin){
- alert("Received '" + message + "' from '" + origin + "'");
- },
- onReady: function() {
- socket.postMessage("Yay, it works!");
- }
- });
- //window.close();
- </script>
- </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement