basic-auth.html 560 B

1234567891011121314151617181920212223
  1. <html>
  2. <body>
  3. <script src="../../static/jquery-2.0.3.min.js"></script>
  4. <script type="text/javascript" charset="utf-8">
  5. var ipcRenderer = require('electron').ipcRenderer;
  6. var port = location.search.substr("?port=".length);
  7. $.ajax({
  8. type: "GET",
  9. url: "http://127.0.0.1:" + port,
  10. headers: {
  11. "Authorization": "Basic " + btoa("test:test")
  12. },
  13. success: function(result) {
  14. ipcRenderer.sendToHost(result);
  15. },
  16. error: function(xhr, status, error) {
  17. ipcRenderer.sendToHost(error);
  18. },
  19. });
  20. </script>
  21. </body>
  22. </html>