I don't see the relevance of running in a browser to this question. A browser may or may not have a touchscreen: if it's running on a phone or tablet it certainly will, if it's running on a laptop it may do (such as the one I am writing this on), if it is running on a desktop PC it probably won't.I have made a program in SDLIDE and put it with WASM in my website and people could play the game in their browser.
The problem came with the lack of a touch screen.
Any solutions on how to do this the good way?
So long as you write your program so that it will run either with a touchscreen (e.g. on a mobile device) or with a keyboard and mouse (e.g. on a desktop PC) it should run OK in a browser, whether or not it has a touchscreen.
The great majority of the supplied example programs run with either a touchscreen or a keyboard and mouse. Sometimes the functionality is reduced with a touchscreen (e.g. both Rubik.bbc and pinball.bbc have additional features when there is a keyboard).
Does that help, or have I misunderstood the question?