Home > Net >  http request by node-red with execution the stript
http request by node-red with execution the stript

Time:01-19

I would like ask, When I use node http request from Node-red for request to any page it returned me whole page like

msg.payload="<'html>
<'script>
function A;
function B;
window.onload = function() {...
etc...
<'/script>
<'body>
<'table>"

How can I execute the functions from the script? So how it could return executed page to node-red? I mean, I need the results from the fucntions and I get just function in payload, so I don't know how could I execute function which are in payload.

Thank you Pavol

CodePudding user response:

The short answer is, you don't.

Running JavaScript embedded in a web page needs all the things a browser provides to the page, e.g. the DOM model these are just not there in the Node-RED runtime.

If you want to load and render a page then you need to look at something like node-red-contrib-nbrowser that will run the page in a virtual browser.

  •  Tags:  
  • Related