CP753951
Posts: 2
Joined: Sat Oct 09, 2021 11:17 pm

Accsessing GPIO Pins from Browser

Sat Oct 09, 2021 11:26 pm

Hi there,

maybe I'm to stupid to Google my Problem but here it is:

I want to Interface the GPIO Pins from a Webbrowser running on the Pi .
So I dont want the Client sending something to the Server which then accsesses the Pins, i want it all to happen on the client side.
Is that possible?

I have already been able to controlle them through nodejs with onoff but aperrently it is not possible to run that in the js part of my HTML file

Thanks for any help

Christian

Heater
Posts: 18599
Joined: Tue Jul 17, 2012 3:02 pm

Re: Accsessing GPIO Pins from Browser

Sun Oct 10, 2021 12:32 pm

Web browsers were designed from the beginning so that they do not give web pages access to files and peripherals on the computer. This is essential for security because web pages can run Javascript downloaded from God knows where. Do you really want Facebook snooping around al your files?

All is not lost though, you can use HTML, CSS and Javascript to create GUI applications along with node.js for accessing files, GPIO etc with Electron: https://www.electronjs.org/

The SD card writer "balenaEtcher" is created with Electron for example.
Memory in C++ is a leaky abstraction .

CP753951
Posts: 2
Joined: Sat Oct 09, 2021 11:17 pm

Re: Accsessing GPIO Pins from Browser

Sun Oct 10, 2021 12:46 pm

Thanks, maybe I should have realized this earlier.

I will look into your suggestions and also have some ideas myself to solve this.

Christian

Return to “Other programming languages”