I am new to the web display of sensor readings and find in several RNT AsyncWebServer examples, that the placeholder for the variable to be inserted by code is surrounded by percentage signs (%). For example,
Here is a sample span from one of the ESP32 examples:
<span id=”humidity”>%LIGHTLEVEL%</span>
I cannot find any reference in HTML standards as to the use of this practice. It seems that the choice of using the % delimiter is more of a personal preference than a standard for identifying placeholders or a manner of formatting the replacement text. Is that correct?
Hi.
The placeholders with %% are just a feature of the AsyncWebServer library. It can identify placeholders between %% and replace them with whatever we want using the processor() function.
It doesn’t work like that in HTML.
Regards,
Sara
Thank you, Sara! In doing some more research I also learned that the % signs are used as delimiters for placeholders because browsers are not going to interpret them as something meaningful since the % sign is not used for other purposes in HTML.