hello can I change the client window object via server node js ?
example :
window.hello
This will be the default variable in the broser window. When I code console.log(hello), the results will appear
1 Answer
No.
A JavaScript program running on Node.js is a completely different program running in a completely different environment (and probably on a completely different computer).
If you want to set a property of the window object in a webpage, then you need JavaScript running in that webpage to do it. (Usually you would load that JS with a <script> element, but a browser extension could do it too).
If you want to pass data from a Node.js program to a browser-side program then you would need to communicate between them with some kind of message (such as an HTTP response, a Web Socket message, or (if you are using Electron instead of a regular browser) an IPC message.