title: How would you decode HTML entities inside the msg.payload in Node-Red with javascript?
body: <p>As part of an experiment, I'm working with Node-Red. I'm creating a simple workflow that, on a click of a button, embeds (downloads html content) from a diversity of websites onto it's own page. </p>
  
  <p>However, the HTML that's extracted, the <code>msg.payload</code>, will automatically be encoded to HTML. Thus, instead of regularly <code>&lt;div&gt;</code>, I'd get <code>&amp;lt;div class=&amp;quot;shot&amp;quot;&amp;gt;</code>. And that wrecks the idea.</p>
  
  <p>With a 'function-node' I could apply any Javascript to the msg.payload, thus the extracted HTML. I need to find a way that decoded the HTML entities back to good ol' HTML.</p>
  
  <p><code>msg.payload</code> already contains, by default, the extracted content, so you could use it in a Javascript var, if needed;</p>
  
  <pre><code>var x = msg.payload
  </code></pre>
  
  <p>So tl;dr: How do I decode HTML entities with just Javascript?</p>
  
  <hr>
  
  <p>If you want to 'fiddle' with my workflow, copy and paste the below code.</p>
  
  <pre><code>[{"id":"b05c9e5a.4fa36","type":"http request","name":"Get to Dribbble","method":"GET","ret":"obj","url":"https://dribbble.com/search?utf8=%E2%9C%93&amp;q=flat+design&amp;s=latest","x":181,"y":169,"z":"9b321f64.64cde","wires":[["93dfb5e5.6c2048"]]},{"id":"c3be5c2.f3c41a","type":"inject","name":"","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":156,"y":106,"z":"9b321f64.64cde","wires":[["b05c9e5a.4fa36"]]},{"id":"93dfb5e5.6c2048","type":"html","name":"Get each Dribbble","tag":".dribbble","ret":"html","as":"multi","x":188,"y":257,"z":"9b321f64.64cde","wires":[["ef6b650e.109498"]]},{"id":"cea8d694.315728","type":"file","name":"","filename":"dribbble/dribbbleFile.html","appendNewline":true,"overwriteFile":"true","x":895,"y":302,"z":"9b321f64.64cde","wires":[]},{"id":"6a37543c.95c8ac","type":"template","name":"","field":"payload","format":"handlebars","template":"&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n&lt;head&gt;\n\t&lt;meta charset=\"UTF-8\"&gt;\n\t    &lt;title&gt;Document&lt;/title&gt;\n    &lt;link href=\"http://iscs.nl/dribbble.css\"&gt;&lt;/link&gt;\n&lt;/head&gt;\n&lt;body&gt;\n\nThis is the payload: {{payload}} !\n\t\n&lt;/body&gt;\n&lt;/html&gt;\n\n\n\n\n\n","x":676,"y":303,"z":"9b321f64.64cde","wires":[["cea8d694.315728"]]},{"id":"ef6b650e.109498","type":"function","name":"","func":"return msg;","outputs":1,"noerr":0,"x":492,"y":303,"z":"9b321f64.64cde","wires":[["6a37543c.95c8ac"]]}]
  </code></pre>