There is no bullet proof solution, but there is this JS library you can use and test. https://github.com/Joe12387/detectIncognito
From the server side i dont think you can check any thing to know if its in incognito mode.