I still might no be understanding the goal here. This lets you return the page in the html buffer and continue merrily executing code.
For example you could do this. print a msg about how the device is restarting and then execute the reboot command . You will see the msg that it is rebooting in the browser and the device will happily reboot. No browser trying to fetch the page until it gives a page not found error.
http://esp8266basic.com
A BASIC interpreter for your ESP
Working now on Autodrop3d. A 3d printer with automatic part ejection system. https://autodrop3d.com