AP MODE ISSUE WITH CHROME BROWSER

david@mandy
Posts: 8
Joined: Tue May 22, 2018 4:59 am

AP MODE ISSUE WITH CHROME BROWSER

Postby david@mandy » Tue May 14, 2019 11:39 am

Hello,
In ESP32 module, we recently found an issue with AP mode. When a device enters the AP mode, the response page on the Google Chrome's latest version i.e. 74.0.3729.136, doesn't really show-up.

In the code, WiFi was initialized as AP mode and was assigned with an IP address of 192.168.4.1 and port as 80.
A basic html page printing "HELLO WELCOME" was sent to the device connected to the esp32 module using the set ssid and password with DHCP enabled in the code. Once the mobile/tablet was connected to the esp32 module successfully, on accessing the http webpage(http://192.168.4.1:80), "HELLO WELCOME" will be displayed. The response received from the browser are attached to the post.
Below is the example code used
2019-05-14_Soft_AP_Code.c
(7.81 KiB) Downloaded 651 times
However the response page on various browsers like Mozilla firefox(v66.0.4), Opera(v51.3.2461.138727) and Google Chrome(v71.0.3578.99) does work absolutely fine.
Below is the screenshot of the response received, when a successful response is posted on the browser with older version of chrome(v71.0.3578.99)
Chrome-v71.0.3578.99.jpg
Chrome-v71.0.3578.99.jpg (201.42 KiB) Viewed 3033 times
The below screenshot is the response received for the unsuccessful posting of the "HELLO WELCOME" on the latest version of the chrome (v74.0.3729.136)
Chrome-v74.0.3729.136.jpg
Chrome-v74.0.3729.136.jpg (230.73 KiB) Viewed 3033 times
.

ESP IDF Used: esp-idf-v3.1.3

Hope to see the response ASAP,
David

username
Posts: 477
Joined: Thu May 03, 2018 1:18 pm

Re: AP MODE ISSUE WITH CHROME BROWSER

Postby username » Tue May 14, 2019 3:11 pm

The issue is your not properly sending the data in a way the browser will understand it properly.
send(clientSock, "HELLO WELCOME", strlen("HELLO WELCOME"), 0);
The browsers wants to know when it receives data what kind of data it is.
I.E. is it text/html, image/x-icon, application/javascript and so on.

Then you set it, httpd_resp_set_type(req, "text/html");
then you send it
httpd_resp_send(req,...)

Have a look at the examples.
https://github.com/espressif/esp-idf/tr ... /protocols

Who is online

Users browsing this forum: No registered users and 136 guests