-
-
Save codebytere/7278c8c62ec976110afb47ef2d861a7a to your computer and use it in GitHub Desktop.
browserview-exclusive-windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Hello World!</title> | |
<link rel="stylesheet" type="text/css" href="./styles.css"> | |
</head> | |
<body> | |
<h1>Hello World!</h1> | |
<h1 style="-webkit-app-region : drag ; border : 1px solid red; width: 300; height: 200; display: inline; -webkit-user-select: none;">DRAGGABLE AREA</h1> | |
<script> | |
// You can also require other files to run in this process | |
require('./renderer.js') | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Modules to control application life and create native browser window | |
const { app, BrowserWindow, BrowserView } = require('electron') | |
app.whenReady().then(() => { | |
// Create the browser window. | |
const mainWindow = new BrowserWindow({ | |
width: 800, | |
height: 500, | |
frame: false, | |
titleBarStyle: "hiddenInset" | |
}) | |
mainWindow.loadFile("index.html"); | |
const view = new BrowserView(); | |
mainWindow.addBrowserView(view); | |
view.setBounds({ | |
x: 400, | |
y: 0, | |
width: 400, | |
height: 300, | |
}); | |
view.webContents.loadFile("index.html"); | |
view.setAutoResize({ | |
width: true, | |
height: true, | |
}); | |
}) | |
app.on('window-all-closed', function () { | |
if (process.platform !== 'darwin') { | |
app.quit() | |
} | |
}) | |
app.on('activate', function () { | |
if (BrowserWindow.getAllWindows().length === 0) { | |
createWindow() | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file is required by the index.html file and will | |
// be executed in the renderer process for that window. | |
// All of the Node.js APIs are available in this process. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Empty */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment