Page 1 of 1

Storing Jquery as a C-string

Posted: Wed Jan 16, 2019 11:38 pm
by dmaxben
Had a quick question regarding the "OTA web updater" program.

I would like to be able to use the web-based updater function without internet access, using the ESP32 as an access point and not a client on an existing network.

Basically, I would like to have a firmware bin stored on my phone, have the ESP32 set itself up as a WiFi access point that I can connect to with my phone. Once connected, the ESP32 hosts a webpage with a "choose file" and "upload" button. Then I can just select the stored firmware .bin on my phone, click upload, and the ESP32 does an OTA firmware update directly from my phone without needing internet access and without needing an existing WiFi network.

The OTA web updater example relies on calling the Jquery JavaScript over the internet. Obviously this will not work for me, as it needs to be hosted locally all by the ESP32.

Simply storing "jquery.min.js" in SPIFFS will NOT work for me because it will create lots of issues with my existing firmware distribution/updating setup.

In the OTA Web updater example, the first line of the serverIndex page has:

"<script src='https://ajax.googleapis.com/ajax/libs/j ... '></script>"

I have tried replacing the URL of the Jquery script with all of the JavaScript text that comes up in my browser when I go to that website....but it does not work.

I know its a matter of formatting it correctly...but I cant figure it out... :?

Thanks

Re: Storing Jquery as a C-string

Posted: Thu Jan 17, 2019 6:24 am
by schuppeste
I think there is a problem with the escape symbols, maybe there is a function for it.

Try before Insert in Code:
http://easyonlineconverter.com/converte ... scape.html

Re: Storing Jquery as a C-string

Posted: Tue Jun 18, 2019 5:16 pm
by spyder0069
I am in the same boat. Did you get this to work? If so would you be willing to share your string? Thanks!

Re: Storing Jquery as a C-string

Posted: Thu Jun 20, 2019 1:59 pm
by dmaxben
spyder0069 wrote:
Tue Jun 18, 2019 5:16 pm
I am in the same boat. Did you get this to work? If so would you be willing to share your string? Thanks!
No, I was never able to figure it out unfortunately... :(

anyone else have ideas?

Re: Storing Jquery as a C-string

Posted: Thu Jun 20, 2019 2:40 pm
by spyder0069
So this is strange. I am using the OTA on a esp32 and my sample code had:

Code: Select all

<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
I assumed this was needed for the OTA to work. I figured out how to work with SPIFFS and just put the file on there and point it to it in the server. I wanted to test and see what the OTA would do with that file missing. It worked? I commented that line out completely and OTA still works? I am not entirely sure what this script does and i have googled and can't find any explanation. I am running the async webserver. I don't know if its code under the hood calls to this or why it doesn't seem to require it. I also disconnected my modem so that I was cutoff from the outside world and IE, Edge, and chrome still worked with OTA. This with the esp running in sta mode. I haven't tried AP in this config yet but it shouldn't matter. Maybe this is now built into the browsers?