# Client Side Environment variable access

**URL:** https://discourse.nodered.org/t/client-side-environment-variable-access/92942
**Category:** General
**Created:** [6 November 2024 14:11 UTC](https://discourse.nodered.org/t/client-side-environment-variable-access/92942 "2024-11-06T14:11:12Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![eddee54455](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddee54455/32/43350_2.png) [@eddee54455](https://discourse.nodered.org/u/eddee54455)
#### Post date: [6 November 2024 14:11 UTC](https://discourse.nodered.org/t/client-side-environment-variable-access/92942/1 "2024-11-06T14:11:12Z")

</div>

Good day all,

I need to be able to set a client side environment variable and access it, when the client is active....

ie client pc opens dashboard, a local (to the client) environment variable is set up by a prompt of: "Hi there, what is your name?".....  
Client then enters their name (Mike) in a text entry field and is stored to $NAME on the client pc...

During dashboard functions, the client can get personalised responses akin to:  
"No, Mike, the Lights are already off."

As there are multiple points running the common dashboard, a single, server side environment variable will not work...

Or am I wrong?

TIA  
Ed

---

<div class="post-metadata">

### Author: ![omrid](https://avatars.discourse-cdn.com/v4/letter/o/77aa72/32.png) [@omrid](https://discourse.nodered.org/u/omrid)
#### Post date: [7 November 2024 08:16 UTC](https://discourse.nodered.org/t/client-side-environment-variable-access/92942/2 "2024-11-07T08:16:49Z")

</div>

You can use a template node which saves the name in a global DOM variable or in a (hidden or not) HTML tag, which you can retrieve via `document.getElementById(...).value`.

But as far as I know, you will not be able to access it via a $NAME property, since these are resolved in the server node, not the client widget.

---

<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: [5 February 2025 08:17 UTC](https://discourse.nodered.org/t/client-side-environment-variable-access/92942/3 "2025-02-05T08:17:10Z")

</div>

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