-->
Page 1 of 4

Accessing WiFi Access Point from a preloaded HTML/Javascript

PostPosted: Sat Feb 22, 2020 10:53 am
by MikeDB
I'm using an ESP8266 which is situated in a field well away from any WiFi network so I have configured it as an Access Point. But I don't want the ESP8266 to serve the webpage as it's hard to update as it's not on any WiFi network. Instead I'd like to download the webpage from a larger server into local storage on a tablet, then walk to the ESP8266, switch the tablet WiFi over to the ESP WiFi, open the downloaded webpage and have it initiate communication with the ESP8266 on the usual 192.168.4.1.
But I can't work out how to do this. Is it possible ?

Re: Accessing WiFi Access Point from a preloaded HTML/Javasc

PostPosted: Sat Feb 22, 2020 1:15 pm
by quackmore
that's the way I test my webpages before downloading into the esp8266

you can find a example on my github https://github.com/quackmore/esp_thermostat/tree/master/web
it's a bit rough but a working one

checkout the esp_queries.js file:
when the files are served by the esp you don't have to specify neither an IP address into the url, nor enabling the cross domain
when you open the files with a browser on your PC, and you want the queries to direct to the esp, you will have to specify the IP address into the url and enabling the cross domain (or the browser will block the query)

Re: Accessing WiFi Access Point from a preloaded HTML/Javasc

PostPosted: Sat Feb 22, 2020 4:07 pm
by MikeDB
quackmore wrote:that's the way I test my webpages before downloading into the esp8266

you can find a example on my github https://github.com/quackmore/esp_thermostat/tree/master/web
it's a bit rough but a working one

checkout the esp_queries.js file:
when the files are served by the esp you don't have to specify neither an IP address into the url, nor enabling the cross domain
when you open the files with a browser on your PC, and you want the queries to direct to the esp, you will have to specify the IP address into the url and enabling the cross domain (or the browser will block the query)


So in your example does the ESP just serve the index.html and the JS files are already present on the other device ?

Re: Accessing WiFi Access Point from a preloaded HTML/Javasc

PostPosted: Sat Feb 22, 2020 9:37 pm
by quackmore
Nope
It's either
All the files are on the esp and the esp serves all
or
All the files are on a PC and the esp just answers the queries