OLD | NEW |
1 <script> | 1 <script> |
2 // Set authentication info | 2 // Set authentication info |
| 3 var port; |
| 4 var w; |
3 window.addEventListener("message", function(evt) { | 5 window.addEventListener("message", function(evt) { |
4 var port = evt.ports[0]; | 6 if (evt.ports[0]) { |
| 7 port = evt.ports[0]; |
5 document.cookie = 'cookie=' + evt.data.cookie; | 8 document.cookie = 'cookie=' + evt.data.cookie; |
6 var xhr = new XMLHttpRequest(); | 9 w = window.open(window.location.protocol + "//" + evt.data.username + ":" +
evt.data.password + "@" + window.location.hostname + ":" + window.location.port
+ "/serviceworker/resources/fetch-access-control.php?Auth&WINDOW", evt.data.user
name); |
7 xhr.addEventListener('load', function() { | 10 } else { |
8 port.postMessage({msg: 'LOGIN FINISHED'}); | 11 w.close(); |
9 }, false); | 12 w = null; |
10 xhr.open('GET', | 13 port.postMessage({msg: 'LOGIN FINISHED'}); |
11 './fetch-access-control.php?Auth', | 14 } |
12 true, | 15 }, false); |
13 evt.data.username, evt.data.password); | 16 </script> |
14 xhr.send(); | |
15 }, false); | |
16 </script> | |
OLD | NEW |