Please describe in detail what you think "pinging the esp8266" means. Again the term "ping" commonly means to send an ICMP packet to a host and measuring the time until it answers with another ICMP packet (echo request and echo response). So a browser cannot ping the ESP.
Of course the ESP8266 knows when the last request was received from a browser, so you can send the ESP8266 to sleep after some time of inactivity. But keep in mind that it won't answer any more requests while sleeping. If you had the impression that a new request will wake up the ESP8266 you're wrong, while sleeping it won't be even connected to the WiFi network.