People ask this a lot. The honest answer depends entirely on whether the console has a proper web browser.
Xbox Series X, Series S and Xbox One have Microsoft Edge, which is the same browser as on a PC. Browser games work. The controller moves a cursor around the page, and games that support gamepads can use the controller directly.
A USB or wireless keyboard and mouse make keyboard games playable too.
In desktop mode the Steam Deck runs a full desktop browser, so it behaves like a small laptop. Browser games work as they would on a PC.
The PS5 has no web browser for you to open. There is no normal way to visit a website on it, so browser games are not an option.
The PS4 has a browser, but it is old. Simple 2D games may load; most modern games, and anything 3D, will not.
The Switch has no general web browser, so browser games cannot be played on it.