How to get address of the browser instance

Far from me the idea of relaunching the debate on multi-user dashboard. I understood that it was not made for !
That said, my application is not fully multi-user: I have 2 user groups. An admin type will have access to all functions. The other no: I just have 3 buttons to disable.
To do this, is it possible one way or another, to retrieve the address appearing in the address bar of the web browser: thus, I will be able to retrieve the user's socketid and carry out my routing in function.

Thanks for your help

If you disable 3 buttons for the 1e user, then the will also be disabled for the other users.

I'm using the ip address of a specific user (tablet living room vs tablet bed room) to do some different actions. For me, load a different floorplan for the different tablets as default.

With ui_control you can get Getchanges and filter the ip address out with msg.socketip.

Maybe this can help you, have fun.

[{"id":"c6c67e1c.63cb1","type":"ui_ui_control","z":"b3f31bbd.8966b8","name":"GetChanges","events":"change","x":130,"y":140,"wires":[["3b5784d6.3a6fc4"]]},{"id":"3b5784d6.3a6fc4","type":"switch","z":"b3f31bbd.8966b8","name":"Device 192.168.0.151","property":"socketip","propertyType":"msg","rules":[{"t":"eq","v":"192.168.0.151","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":360,"y":140,"wires":[["75e63278.81e8bc"]]}]
1 Like

You can get the browser url as below.
add one for each tab, when tab loads the url will be sent in the payload.

[{"id":"197cb9b.8e143c6","type":"ui_template","z":"b779de97.b1b46","group":"ada4e0c8.ca2d58","name":"","order":0,"width":0,"height":0,"format":"<script>\n(function(scope) {\n    scope.send({payload: window.location.href});  \n})(scope);\n</script>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":450,"y":3520,"wires":[["1adc3f5c.41ec09"]]},{"id":"1adc3f5c.41ec09","type":"debug","z":"b779de97.b1b46","name":"","active":true,"console":"false","complete":"false","x":719,"y":3520,"wires":[]},{"id":"ada4e0c8.ca2d58","type":"ui_group","z":"b779de97.b1b46","name":"Default","tab":"e4c8df5a.bc9048","order":1,"disp":true,"width":"6"},{"id":"e4c8df5a.bc9048","type":"ui_tab","z":"b779de97.b1b46","name":"tab2","icon":"dashboard"}]
<script>
(function(scope) {
    scope.send({payload: window.location.href});  
})(scope);
</script>

[edit]
you can also get the port , hostname and more if required

1 Like

Thank you for your reply. Your idea is indeed interesting. My problem is that a priori, I can not know the fixed IP addresses of the computers to be connected. But I retain your solution for possible future projects.

@E1cid suggestion will return the IP address in msg.socketip of whatever device connects to the dashboard. Here is what I get connecting from an iPhone:
Screen Shot 2021-09-15 at 5.09.42 AM

thanks for all !

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