webview-origin-zoom-level.html 598 B

123456789101112131415161718192021
  1. <html>
  2. <body>
  3. <webview nodeintegration src="zoom://host1" id="view" partition="webview-temp"/>
  4. </body>
  5. <script>
  6. const {ipcRenderer} = require('electron')
  7. const view = document.getElementById('view')
  8. const view2 = document.createElement('webview')
  9. view.addEventListener('dom-ready', () => {
  10. view.setZoomLevel(2.0)
  11. view2.src = "zoom://host1"
  12. view2.partition = "webview-temp"
  13. document.body.appendChild(view2)
  14. })
  15. view2.addEventListener('dom-ready', () => {
  16. view2.getZoomLevel((level) => {
  17. ipcRenderer.send('webview-origin-zoom-level', level)
  18. })
  19. })
  20. </script>