How to hide scrollbar in electron's BrowserView?

1.9k Views Asked by At

I am trying electron's BrowserView to embed third party web content in an Electron BrowserWindow.

My electron version is 10.

// In the main process.
const { BrowserView, BrowserWindow } = require('electron')

const win = new BrowserWindow({ width: 800, height: 600 })

const view = new BrowserView()
win.setBrowserView(view)
view.setBounds({ x: 0, y: 0, width: 300, height: 300 })
view.webContents.loadURL('https://electronjs.org')

This is working fine and now I wanted to hide scrollbars by adding a line

view.webContents.insertCSS('html, body { overflow: hidden; }')

but this is not hiding scrollbar. How can I hide scrollbar in BrowserView?

0

There are 0 best solutions below