diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c
index 1e0fe874cdfb32f654ca380be0833e15f6ca819e..76e2f37d7e0b2a6bf3217966c0e6921ac8084e1a 100644
--- a/src/sdl/i_system.c
+++ b/src/sdl/i_system.c
@@ -103,6 +103,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
 #endif
 #endif
 
+#ifdef __EMSCRIPTEN__
+#undef HAVE_TERMIOS // do not read on /dev/tty, JavaScript alert() are blocking
+#endif
+
 #if defined(UNIXCOMMON)
 #include <poll.h>
 #endif
@@ -799,6 +803,11 @@ static inline void I_StartupConsole(void)
 
 	framebuffer = M_CheckParm("-framebuffer");
 
+#ifdef __EMSCRIPTEN__
+	framebuffer = SDL_FALSE;
+	consolevent = SDL_TRUE;
+#endif
+
 	if (framebuffer)
 		consolevent = SDL_FALSE;
 }
@@ -972,7 +981,9 @@ void I_OutputMsg(const char *fmt, ...)
 #endif
 
 	if (!framebuffer)
+	{
 		fprintf(stderr, "%s", txt);
+	}
 #ifdef HAVE_TERMIOS
 	if (consolevent && txt[len-1] == '\n')
 	{