سؤال

I have a webserver that does not have the PHP protocol. It only has HTML. (its a raspberry pi running webiopi) I do connect to this page via smartphone, but since there are many i do not 100% know to what raspberry i am connected because IP addresses change regularely. I need a way to display the HOST name of the pi (i mean the computer name) inside the page. Since html is static i can only think of Javascript, but Javascript is executed at client side so i have no idea how to get the host name of the raspberry.

Any ideas?

--- additional info ----

will make clones of this rasp, thats the reason why it cant be hardcoded into html.

هل كانت مفيدة؟

المحلول

Doesn't webiopi use Python? Why can't you use that to put the dynamic hostname into the HTML?

Go here for an idea of how to put your markup together: http://code.google.com/p/webiopi/wiki/CUSTOMIZE

Go here for an example on how to grab the host info using python: How can I use Python to get the system hostname?

نصائح أخرى

You only have one webserver. Put the host name inside the HTML.

If you have clones, you have a process that changes the host name. Add to the script that sets the host name a routine that will overwrite an short HTML file, which could in turn be loaded in via JavaScript or iframe into every page. JavaScript may be useful if this host name is likely to change after the page has loaded, as you could reload the host name regularly.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top