1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

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.
This commit is contained in:
M Hightower 2020-04-19 02:14:20 -07:00 committed by GitHub
parent ce0e63f629
commit 4ca69bc21d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 9 deletions

View File

@ -8,9 +8,11 @@ DNSServer dnsServer;
ESP8266WebServer webServer(80); ESP8266WebServer webServer(80);
String responseHTML = "" String responseHTML = ""
"<!DOCTYPE html><html><head><title>CaptivePortal</title></head><body>" "<!DOCTYPE html><html lang='en'><head>"
"<h1>Hello World!</h1><p>This is a captive portal example. All requests will " "<meta name='viewport' content='width=device-width'>"
"be redirected here.</p></body></html>"; "<title>CaptivePortal</title></head><body>"
"<h1>Hello World!</h1><p>This is a captive portal example."
" All requests will be redirected here.</p></body></html>";
void setup() { void setup() {
WiFi.mode(WIFI_AP); WiFi.mode(WIFI_AP);

View File

@ -30,8 +30,8 @@ const char *softAP_password = APPSK;
const char *myHostname = "esp8266"; const char *myHostname = "esp8266";
/* Don't set this wifi credentials. They are configurated at runtime and stored on EEPROM */ /* Don't set this wifi credentials. They are configurated at runtime and stored on EEPROM */
char ssid[32] = ""; char ssid[33] = "";
char password[32] = ""; char password[65] = "";
// DNS server // DNS server
const byte DNS_PORT = 53; const byte DNS_PORT = 53;
@ -140,4 +140,3 @@ void loop() {
//HTTP //HTTP
server.handleClient(); server.handleClient();
} }

View File

@ -9,7 +9,9 @@ void handleRoot() {
String Page; String Page;
Page += F( Page += F(
"<html><head></head><body>" "<!DOCTYPE html><html lang='en'><head>"
"<meta name='viewport' content='width=device-width'>"
"<title>CaptivePortal</title></head><body>"
"<h1>HELLO WORLD!!</h1>"); "<h1>HELLO WORLD!!</h1>");
if (server.client().localIP() == apIP) { if (server.client().localIP() == apIP) {
Page += String(F("<p>You are connected through the soft AP: ")) + softAP_ssid + F("</p>"); Page += String(F("<p>You are connected through the soft AP: ")) + softAP_ssid + F("</p>");
@ -43,7 +45,9 @@ void handleWifi() {
String Page; String Page;
Page += F( Page += F(
"<html><head></head><body>" "<!DOCTYPE html><html lang='en'><head>"
"<meta name='viewport' content='width=device-width'>"
"<title>CaptivePortal</title></head><body>"
"<h1>Wifi config</h1>"); "<h1>Wifi config</h1>");
if (server.client().localIP() == apIP) { if (server.client().localIP() == apIP) {
Page += String(F("<p>You are connected through the soft AP: ")) + softAP_ssid + F("</p>"); Page += String(F("<p>You are connected through the soft AP: ")) + softAP_ssid + F("</p>");
@ -130,4 +134,3 @@ void handleNotFound() {
server.sendHeader("Expires", "-1"); server.sendHeader("Expires", "-1");
server.send(404, "text/plain", message); server.send(404, "text/plain", message);
} }