Running in a browser - how do i know?

Godot Version

4.3rc3

Question

My “load resolution from prefs file” code screws up my Web build on Itch.io (half the screen is cut off). Runs fine in the browser if i don’t load/set the resolution. But that’s annoying in the Windows build. Is there a way to know if i’m running in a browser?

if !RunningInBrowser:
    var window_size = config.get_value("Video", "resolution")
    get_window().set_size(window_size)

Use OS.get_name()

1 Like

My god, that works. i love you. i will name my next four children after you.

Seriously, that “doesn’t fit in browser viewport” thing was seriously obnoxious and caused me multiple upload mistakes as i tried to make sure i commented out my graphics settings before uploading. My children will be glad to be named after you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.