Open web page using URL

Is there any node that allows me to open a web page using its URL adress ?

Not sure I know what you mean. The flow executes on the server not the browser. So where would this web page be seen? The http request node can go and get a web page which you can then parse.

If you want the dashboard to link to another site use a ui-template node. Here is an example that will link to google.

[{"id":"71bd6044.791278","type":"ui_template","z":"27e6a447.75ae8c","group":"d8596899.c56458","name":"","order":0,"width":0,"height":0,"format":"<div>\n    <a href=\"http://google.com\"><span>Google</span></a>\n</div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":580,"y":300,"wires":[[]]},{"id":"d8596899.c56458","type":"ui_group","z":"","name":"Default","tab":"ae47cffa.963c78","disp":true,"width":"6","collapse":false},{"id":"ae47cffa.963c78","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]
2 Likes

yeah that's what i'm searching about , thank you a lot :slight_smile:
is there any other solution ? a node for example ?

1 Like

i want juste to make a link to a certain site

In the right panel of the dashboard editor you can add a link

2 Likes

Good idea ! thank you :slight_smile:

In case I want to open a web page with query parameters like "www.google.com?x=1&y=2 the character & makes the above example non functioning due to error. How do I change (encode) the request so that I can add more parameters?

Actually my aim is to have a link to google maps api with lat and lon as parameters. The link would be in the node-red UI and when clicking a new page should open showing the map. Those location parameters will come from a gps IOT device installed on my boat.

Thanks in advance for any help.

it works for me

[{"id":"5f91d80d.9b428","type":"ui_template","z":"eaea399f.2dd2e8","group":"2007caa7.9dc636","name":"","order":0,"width":0,"height":0,"format":"<div>\n    <a href=\"http://www.google.com?x=1&y=2\"><span>Google</span></a>\n</div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":370,"y":152,"wires":[[]]},{"id":"2007caa7.9dc636","type":"ui_group","z":"","name":"Default","tab":"ad0e1f68.c10fd","disp":true,"width":"6","collapse":false},{"id":"ad0e1f68.c10fd","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]

As always I will add a plug for https://flows.nodered.org/node/node-red-contrib-web-worldmap :slight_smile: as we already have some boat friendly layers built in.

If I copy this from your post to my node-red without modifications, I got a red error mark on line 2 saying "Named entity expected. Got none". If I then add a space between & and y the error goes away, but obviously that is not an acceptable url.

Any hints?

Wow, I didn't know about this. Very interesting. Thanks!

What version of node-red-dashboard are you using?

It's v0.19.4

That’s hopefully the version of node-red not the dashboard.
You can check the version of the dashboard in the menu under manage palette.

Oh, sorry, my bad :). It was 2.13.0 so I updated it to the latest. Still same error visible.
But now I noticed that in case I deploy despite of this error mark, it works OK. Do not know if that is due to the latest version because I think I couldn't deploy earlier when this error was shown.

It would be interesting to know what is the reason in case you do not see the error mark, but I can live with this as it seems to do what I need now.

Thanks for the help.

If you can it's probably worth upgrading to v0.20.x as well... If you installed it yourself on a pi there's a simple upgrade script on the raspberry pi page in the docs

Thanks for the hint. I did that and running now with v0.20.5. Still the same status, but it works:

Now I need to figure out how do I pass the x and y in previous example as parameters coming from the gps via MQTT-node to this ui_template :slight_smile:

In valid HTML the & indicates the start of an entity reference. So although it's a valid character in a URL (as you type it on the location bar in your browser), it's not correct within an HTML document.

To be "correct" you should replace the & in the href= with &amp; which would result in:
<a href="http://www.google.com?x=1&amp;y=2">
Which will work correctly and remove the flagged error.

The error given is a real error, but what you have got there is such a common mistake that browsers have been coded to "do the right thing" in this situation.

Hope that helps, if a little late. :slight_smile:

3 Likes

Thanks for the good explanation Chinchilla. It helped to understand the reason for the error.