A
A
ALX3452022-03-07 19:11:08
JavaScript
ALX345, 2022-03-07 19:11:08

NodeJS - How to hide HTML WebView code?

Good day. There is a web-view application on nodejs and electron.
The html initialization goes like this:

mainWindow.loadURL(`file://${__dirname}/index.html`);


Does Node have options to pass html/javascript to webview without passing external html?
Would like something like:
var HTML="<html></html>";
mainWindow.load(HTML);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Shipin, 2022-03-08
@ALX345

There is.
Without executing the script that is on the page

mainWindow.loadURL('data:text/html;charset=utf-8,<YOUR HTML/>');

With the execution of the script that is on the page
mainWidnow.loadURL('data:text/html;charset=utf-8,<body>YOUR HTML<script>alert(1)</script></body>');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question