24 lines
751 B
HTML
24 lines
751 B
HTML
<html>
|
|
<body>
|
|
<webview nodeintegration src="app://host1" id="view" partition="webview-temp"/>
|
|
</body>
|
|
<script>
|
|
const {ipcRenderer, webFrame} = require('electron')
|
|
const view = document.getElementById('view')
|
|
let finalNavigation = false
|
|
view.addEventListener('dom-ready', () => {
|
|
if (!finalNavigation && !view.canGoBack()) {
|
|
view.setZoomLevel(2.0)
|
|
}
|
|
const zoomLevel = view.getZoomLevel()
|
|
const zoomFactor = view.getZoomFactor()
|
|
ipcRenderer.send('webview-zoom-level', zoomLevel, zoomFactor, view.canGoBack(), finalNavigation)
|
|
if (!view.canGoBack() && !finalNavigation) {
|
|
view.src = 'app://host2'
|
|
} else if (!finalNavigation) {
|
|
finalNavigation = true
|
|
view.goBack()
|
|
}
|
|
})
|
|
</script>
|
|
</html>
|