Skip to content

Commit 4ca69bc

Browse files
authored
For example CaptivePortal, update HTML to pass HTML checker. (#7227)
Added meta viewport element for better mobile device viewing. For example CaptivePortalAdvanced, increased size of ssid and password array to hold maximums 32 and 64 charcter strings. Added missing HTML elments to main splash and wifi config. They should now pass an HTML checker. Also added meta viewport element for better mobile device viewing.
1 parent ce0e63f commit 4ca69bc

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

libraries/DNSServer/examples/CaptivePortal/CaptivePortal.ino

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ DNSServer dnsServer;
88
ESP8266WebServer webServer(80);
99

1010
String responseHTML = ""
11-
"<!DOCTYPE html><html><head><title>CaptivePortal</title></head><body>"
12-
"<h1>Hello World!</h1><p>This is a captive portal example. All requests will "
13-
"be redirected here.</p></body></html>";
11+
"<!DOCTYPE html><html lang='en'><head>"
12+
"<meta name='viewport' content='width=device-width'>"
13+
"<title>CaptivePortal</title></head><body>"
14+
"<h1>Hello World!</h1><p>This is a captive portal example."
15+
" All requests will be redirected here.</p></body></html>";
1416

1517
void setup() {
1618
WiFi.mode(WIFI_AP);

libraries/DNSServer/examples/CaptivePortalAdvanced/CaptivePortalAdvanced.ino

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ const char *softAP_password = APPSK;
3030
const char *myHostname = "esp8266";
3131

3232
/* Don't set this wifi credentials. They are configurated at runtime and stored on EEPROM */
33-
char ssid[32] = "";
34-
char password[32] = "";
33+
char ssid[33] = "";
34+
char password[65] = "";
3535

3636
// DNS server
3737
const byte DNS_PORT = 53;
@@ -140,4 +140,3 @@ void loop() {
140140
//HTTP
141141
server.handleClient();
142142
}
143-

libraries/DNSServer/examples/CaptivePortalAdvanced/handleHttp.ino

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ void handleRoot() {
99

1010
String Page;
1111
Page += F(
12-
"<html><head></head><body>"
12+
"<!DOCTYPE html><html lang='en'><head>"
13+
"<meta name='viewport' content='width=device-width'>"
14+
"<title>CaptivePortal</title></head><body>"
1315
"<h1>HELLO WORLD!!</h1>");
1416
if (server.client().localIP() == apIP) {
1517
Page += String(F("<p>You are connected through the soft AP: ")) + softAP_ssid + F("</p>");
@@ -43,7 +45,9 @@ void handleWifi() {
4345

4446
String Page;
4547
Page += F(
46-
"<html><head></head><body>"
48+
"<!DOCTYPE html><html lang='en'><head>"
49+
"<meta name='viewport' content='width=device-width'>"
50+
"<title>CaptivePortal</title></head><body>"
4751
"<h1>Wifi config</h1>");
4852
if (server.client().localIP() == apIP) {
4953
Page += String(F("<p>You are connected through the soft AP: ")) + softAP_ssid + F("</p>");
@@ -130,4 +134,3 @@ void handleNotFound() {
130134
server.sendHeader("Expires", "-1");
131135
server.send(404, "text/plain", message);
132136
}
133-

0 commit comments

Comments
 (0)