Support opening web pages on emscripten.

This commit is contained in:
Bartosz Taudul 2022-10-05 01:22:35 +02:00
parent 7552341ff0
commit 5940af8995
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -1,6 +1,8 @@
#ifdef _WIN32
# include <windows.h>
# include <shellapi.h>
#elif defined __EMSCRIPTEN__
# include <emscripten.h>
#else
# include <stdio.h>
# include <stdlib.h>
@ -19,6 +21,8 @@ void OpenWebpage( const char* url )
char buf[1024];
sprintf( buf, "open %s", url );
system( buf );
#elif defined __EMSCRIPTEN__
EM_ASM( { window.open( UTF8ToString( $0 ), '_blank' ) }, url );
#else
char buf[1024];
sprintf( buf, "xdg-open %s", url );