electron/spec/fixtures/pages/webview-custom-zoom-level.html
2017-02-18 01:34:32 +05:30

23 lines
625 B
HTML

<html>
<body>
<webview nodeintegration src="a.html" id="view"/>
</body>
<script>
const {ipcRenderer, webFrame} = require('electron')
const view = document.getElementById('view')
let finalNavigation = false
view.addEventListener('dom-ready', () => {
if (!finalNavigation)
view.setZoomLevel(2.0)
view.getZoomLevel((zoomLevel) => {
view.getZoomFactor((zoomFactor) => {
ipcRenderer.send('webview-zoom-level', zoomLevel, zoomFactor, finalNavigation)
if (!finalNavigation) {
finalNavigation = true
view.src = 'b.html'
}
})
})
})
</script>
</html>