NWJS - Is it possible to intercept loading of JS from a remote page, and inject my own?

Viewed 46

I am trying to debug an issue with an NWJS app I have made, which loads a web page from a surveillance camera on my network into an iframe.

Is there a way I can intercept the loading of the javascript files, allowing me to inject my own JS for debugging?

1 Answers

When opening a new window, you can use inject_js_start or inject_js_end. Which, if you just need this for debugging, that will likely be the easiest approach.

nw.Window.open('https://example.com', { inject_js_start: 'file.js' });

For an iframe, I'm not sure if there is a similar feature. There is postMessage for communicating with an iframe.

There is also webview which is a special type of iframe that some use in NW.js:

Related