add zoom specs based on standard protocols
This commit is contained in:
parent
0c022fdc36
commit
a57af31b99
5 changed files with 79 additions and 14 deletions
|
@ -1,20 +1,23 @@
|
|||
<html>
|
||||
<body>
|
||||
<webview nodeintegration src="a.html" id="view"/>
|
||||
<webview nodeintegration src="zoom://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)
|
||||
if (!finalNavigation && !view.canGoBack()) {
|
||||
view.setZoomLevel(2.0)
|
||||
}
|
||||
view.getZoomLevel((zoomLevel) => {
|
||||
view.getZoomFactor((zoomFactor) => {
|
||||
ipcRenderer.send('webview-zoom-level', zoomLevel, zoomFactor, finalNavigation)
|
||||
if (!finalNavigation) {
|
||||
ipcRenderer.send('webview-zoom-level', zoomLevel, zoomFactor, view.canGoBack(), finalNavigation)
|
||||
if (!view.canGoBack() && !finalNavigation) {
|
||||
view.src = 'zoom://host2'
|
||||
} else if (!finalNavigation) {
|
||||
finalNavigation = true
|
||||
view.src = 'b.html'
|
||||
view.goBack()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue