Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom HTML at the Top of "<body>" #1695

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions WiFiManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,7 @@ String WiFiManager::getHTTPHead(String title){
page += FPSTR(HTTP_HEAD_END);
}

page += _customTopBodyElement;
return page;
}

Expand Down Expand Up @@ -2889,6 +2890,16 @@ void WiFiManager::setCustomHeadElement(const char* html) {
_customHeadElement = html;
}

/**
* set custom top body html
* custom element will be added to shortly after body tag opened, eg. to show a logo etc.
* @access public
* @param char element
*/
void WiFiManager::setCustomTopBodyElement(const char* html) {
_customTopBodyElement = html;
}

/**
* set custom menu html
* custom element will be added to menu under custom menu item.
Expand Down
8 changes: 6 additions & 2 deletions WiFiManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ class WiFiManager
//add custom html at inside <head> for all pages
void setCustomHeadElement(const char* html);

//add custom html at start of <body> for all pages
void setCustomTopBodyElement(const char* html);

//if this is set, customise style
void setCustomMenuHTML(const char* html);

Expand Down Expand Up @@ -596,8 +599,9 @@ class WiFiManager
boolean _disableConfigPortal = true; // FOR autoconnect - stop config portal if cp wifi save
String _hostname = ""; // hostname for esp8266 for dhcp, and or MDNS

const char* _customHeadElement = ""; // store custom head element html from user isnide <head>
const char* _customMenuHTML = ""; // store custom head element html from user inside <>
const char* _customHeadElement = ""; // store custom head element html from user inside <head>
const char* _customTopBodyElement = ""; // store custom top body element html from user inside <body>
const char* _customMenuHTML = ""; // store custom menu html from user
String _bodyClass = ""; // class to add to body
String _title = FPSTR(S_brand); // app title - default WiFiManager

Expand Down