Let's say your game got a native width of 640 and height of 480 pixels.
Now make an event that sets the layout scale to Browser.ExecJS("window.innerWidth")/640. In a subevent you should check if LayoutScale*480 is greater than Browser.ExecJS("window.innerHeight") and set the scale to Browser.ExecJS("window.innerHeight")/480 instead.
This measure prevents parts of the layout from being cut off because there isn't enough vertical space available.
Now you need to set the canvas size to 640*LayoutScale in width and 480*LayoutScale in height.
The result should be basically the same as if you had letterbox fullscreen enabled. In preview it will add the border for non fullscreen projects that will mess it up a little.
Of course now you can make an event that sets it to half that size easily or control it in any other way. This can also be useful if you licensed a game and you are asked to add dynamic resizing to your game as part of the API implementation.