# DB2: Problem open a new tab with given url

**URL:** <https://discourse.nodered.org/t/db2-problem-open-a-new-tab-with-given-url/98906>\
**Category:** Dashboard\
**Tags:** dashboard-2\
**Created:** [1 September 2025 17:14 UTC](https://discourse.nodered.org/t/db2-problem-open-a-new-tab-with-given-url/98906 "2025-09-01T17:14:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WhiteLion](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/whitelion/32/12266_2.png) [@WhiteLion](https://discourse.nodered.org/u/WhiteLion)\
**Post date:** [1 September 2025 17:14 UTC](https://discourse.nodered.org/t/db2-problem-open-a-new-tab-with-given-url/98906/1 "2025-09-01T17:14:49Z")

</div>

Hiho friends,  
i ve a problem with a simple thing:  
I want to open a new tab with a given url when clicking on a button. I tested stuff out but failed at the point where a tab was opened (like I wish) but when making a reload or revisiting the site I opened the tab from it opened it from just the revisiting. Here i where I ve got to:

```flows
[{"id":"cff55d870276896d","type":"ui-template","z":"9ab7988b0e4273a5","d":true,"group":"e25a141b0e6a7d47","page":"","ui":"","name":"clickLinkDB2","order":4,"width":"6","height":"2","head":"","format":"<script>\n export default {\n data() {\n return {\n macId: \"\",\n hasProcessedMessage: false // Flag für verarbeitete Nachrichten\n };\n },\n watch: {\n msg: {\n handler: function(newMsg) {\n // Prüfen ob eine gültige Nachricht vorliegt\n if (!newMsg || !newMsg.mac) {\n return;\n }\n\n // MacId beim ersten Mal setzen\n if (!this.macId) {\n this.macId = newMsg.mac;\n }\n\n // Nur verarbeiten wenn es die richtige MAC ist und ein Payload vorhanden ist\n if (newMsg.mac === this.macId && newMsg.payload && newMsg.payload !== null) {\n // Verhindern von mehrfacher Verarbeitung derselben Nachricht\n if (!this.hasProcessedMessage) {\n this.hasProcessedMessage = true;\n \n // Neues Tab öffnen\n window.open(newMsg.payload, '_blank');\n \n // Flag nach kurzer Zeit zurücksetzen für nächsten Klick\n setTimeout(() => {\n this.hasProcessedMessage = false;\n }, 1000);\n }\n }\n },\n immediate: false // Verhindert Ausführung beim Component-Mount\n }\n },\n mounted() {\n // Beim Laden der Komponente nichts tun\n }\n }\n</script>\n<style>\n .hidden-template {\n display: none !important;\n }\n</style>","storeOutMessages":true,"passthru":true,"resendOnRefresh":true,"templateScope":"local","className":"hidden-template","x":1970,"y":700,"wires":[[]]},{"id":"7852f186e1b499a6","type":"function","z":"9ab7988b0e4273a5","d":true,"name":"getIpFormMac","func":"let mac = \"18:01:f1:94:85:d4\";\nmac = mac.toLowerCase();\nlet arp = msg.payload;\nif(arp === \"empty\") return null;\n\nlet macFound = false;\nlet arryCounter = 0;\nfor(let entry in arp)\n{\n if (arp[arryCounter].mac === mac) \n {\n macFound = true;\n break;\n } \n arryCounter+=1;\n}\n\nif(macFound === true) {\n msg.ip = arp[arryCounter].ip;\n msg.mac = mac;\n msg.linkId = mac;\n msg.payload = \"http://\" + msg.ip;\n \n // Nach kurzer Zeit Payload zurücksetzen (optional)\n setTimeout(() => {\n flow.set(\"lastProcessed\", Date.now());\n }, 100);\n \n return msg;\n}\n\nmsg.arryCounter = arryCounter;\nmsg.mac = mac;\nmsg.arp = arp;\nmsg.payload = 0;\n//return msg;\nreturn null;\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1980,"y":660,"wires":[["cff55d870276896d"]]},{"id":"244dbbcb828390fc","type":"ui-button","z":"9ab7988b0e4273a5","d":true,"group":"e25a141b0e6a7d47","name":"Cam 4 - Garten - Oberfläche","label":"Cam 4 - Garten - Oberfläche","order":3,"width":0,"height":0,"emulateClick":false,"tooltip":"","color":"","bgcolor":"","className":"","icon":"","iconPosition":"left","payload":"true","payloadType":"bool","topic":"topic","topicType":"msg","buttonColor":"","textColor":"","iconColor":"","enableClick":true,"enablePointerdown":false,"pointerdownPayload":"","pointerdownPayloadType":"str","enablePointerup":false,"pointerupPayload":"","pointerupPayloadType":"str","x":1940,"y":620,"wires":[["7852f186e1b499a6"]]},{"id":"e25a141b0e6a7d47","type":"ui-group","name":"Webcams Ansichten","page":"94749b1b8a1d2fa3","width":"14","height":"1","order":4,"showTitle":true,"className":"","visible":"true","disabled":"false"},{"id":"94749b1b8a1d2fa3","type":"ui-page","name":"Webcams","ui":"282ba4e5c6170cd2","path":"/webcams","icon":"home","layout":"flex","theme":"97db8f45911448c5","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":15,"className":"","visible":true,"disabled":false},{"id":"282ba4e5c6170cd2","type":"ui-base","name":"Dashboard 2.0","path":"/dashboard","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showReconnectNotification":true,"notificationDisplayTime":5,"showDisconnectNotification":true,"allowInstall":true},{"id":"97db8f45911448c5","type":"ui-theme","name":"Default Theme","colors":{"surface":"#ffffff","primary":"#0094CE","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"3318d37bf9878300","type":"global-config","env":[],"modules":{"@flowfuse/node-red-dashboard":"1.26.0"}}]

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [1 October 2025 17:15 UTC](https://discourse.nodered.org/t/db2-problem-open-a-new-tab-with-given-url/98906/2 "2025-10-01T17:15:47Z")

</div>

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