Add viewport meta tag to web server layout (#2419)

* Update web_server.cpp

Added viewport meta tag to web_server.cpp in order to better control layout on mobile browsers. Adds 70 characters. Vastly improves accessibility on mobile devices.

* Update web_server.cpp

split line to meet clang format requirement.

* Update web_server.cpp

Reworked line break for clangtidy
This commit is contained in:
Andy Allsopp 2021-09-30 12:03:30 +01:00 committed by GitHub
parent 3dfc8d4291
commit 946db3fd50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -164,7 +164,9 @@ float WebServer::get_setup_priority() const { return setup_priority::WIFI - 1.0f
void WebServer::handle_index_request(AsyncWebServerRequest *request) { void WebServer::handle_index_request(AsyncWebServerRequest *request) {
AsyncResponseStream *stream = request->beginResponseStream("text/html"); AsyncResponseStream *stream = request->beginResponseStream("text/html");
std::string title = App.get_name() + " Web Server"; std::string title = App.get_name() + " Web Server";
stream->print(F("<!DOCTYPE html><html lang=\"en\"><head><meta charset=UTF-8><title>")); stream->print(F("<!DOCTYPE html><html lang=\"en\"><head><meta charset=UTF-8>"
"<meta name=\"viewport\" content=\"width=device-width, "
"initial-scale=1.0\"><title>"));
stream->print(title.c_str()); stream->print(title.c_str());
stream->print(F("</title>")); stream->print(F("</title>"));
#ifdef WEBSERVER_CSS_INCLUDE #ifdef WEBSERVER_CSS_INCLUDE