native-window-open-cross-origin.html 549 B

1234567891011121314151617181920
  1. <html>
  2. <body>
  3. <script type="text/javascript" charset="utf-8">
  4. const {ipcRenderer} = require('electron')
  5. const popup = window.open('http://127.0.0.1')
  6. const intervalID = setInterval(function () {
  7. try {
  8. if (popup.location.toString() !== 'about:blank') {
  9. clearInterval(intervalID)
  10. ipcRenderer.send('answer', `Did not throw error accessing location: ${popup.location}`)
  11. }
  12. } catch (error) {
  13. clearInterval(intervalID)
  14. ipcRenderer.send('answer', error.message)
  15. }
  16. }, 10)
  17. </script>
  18. </body>
  19. </html>