Link to Media in Template node (HTML)

i hope its ok that i ask that question here, i didnt found an answer yet.

I would like to link Media in my Intranet on a HTML Table.

My template Node gets the data from a function node with following code:

let arr = []
let obj

var Grundpfad = " file:\\\\\\sourcepath to the media";
var k = 0 //Komponentenzähler

function isNull() {
    for (var i = 0; i < arguments.length; i++) {
        if (
            typeof arguments[i] !== 'undefined'
            && arguments[i] !== undefined
            && arguments[i] != null
            && arguments[i] != NaN
            && arguments[i] 
        ) return arguments[i];
for(let i=0;i<k;i++){
    obj = {}
    obj.Device_Name = msg.payload[i].Device_Name
    obj.Device_Nr = msg.payload[i].Device_Nr
    obj.Device_Serial = msg.payload[i].Device_Serial
    obj.Device_Type = msg.payload[i].Device_Type
    obj.Booking_DateTime = msg.payload[i].Booking_DateTime
    obj.Booking_Remarks = msg.payload[i].Booking_Remarks
    obj.Location_Name = msg.payload[i].Location_Name
    obj.Documents = "<a href=" + Grundpfad + msg.payload[i].Documents + "</a>"//the last part of the path
    obj.Documents = "Kein Dokument hinterlegt" 

const komps = arr;

function compare(a, b) {
  const Device_TypeA = a.Device_Type.toUpperCase();
  const Device_TypeB = b.Device_Type.toUpperCase();

  let comparison = 0;
  if (Device_TypeA > Device_TypeB) {
    comparison = 1;
  } else if (Device_TypeA < Device_TypeB) {
    comparison = -1;
  return comparison;


msg.payload = komps

msg.topic = k

return msg;

The table in the template node looks like this:

var grundpfad = "teststuff"

<table id="table" border="1">
        <th style="width: 10%;" >Gerätename</th> 
        <th style="width: 10%;" >Laufende Nummer</th>
        <th style="width: 10%;" >Seriennummer</th>
        <th style="width: 5%;" >Typ</th>
        <th style="width: 5%;" >Buchungsdatum</th>
        <th style="width: 16%;" >Remark</th>
        <th style="width: 6%;" >Ort</th>
        <th style="width: 60%;" >Medium1</th> 
        <th style="width: 20%;" >Medium2</th>
        <th style="width: 20%;" >Medium3</th>
 <tr ng-repeat="row in msg.payload">
   <td ng-repeat="item in row" >{{item}}</td>

What i dont get is a working Link for Pics or PDFs for the Browser to open, or a way to display the media in the table.

I am not good in html, perhaps somebody may help ?


After working some more time on it, i found out that the security of the Browser wont let me translate html links to a filesystem link to open the file.

The best what i get is rightklick - oben in new tab - enter the link in the new tab.

If somebody has knowlege about that, please feel free to share :slight_smile:

If you put the files in a folder under .node-red, say static for example, and in settings.js you put something like
httpStatic: '/home/thenodereduser/.node-red/static/',
then you will be able to access them through node-red using `http://ip:1880/filename

Its our company Network and i want to use files and folders in our network.

May be node red could be setup in an other way to reach this.
Perhaps i get new ideas or find something else.
But i hope for some good ideas in the Node Red Forum.
Here I found very good help :slight_smile:


I think your company IT department might not like the idea of being able to open random files around the network in a browser. I think there are potential security issues there, but I may be wrong.

I need to put that on hold until next year. Vacation...
I will talk with the Head of our IT early January. The usage would be only internally, and the files are reachable internally for the employees i try to make it for. so no trouble i think.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.