Firefox on Android is misbehaving
K.V.
23 May 2021, 20:28I don't know what could be done about this, but someone might find it eyebrow-raising.
https://play2.textadventures.co.uk/Play.aspx?id=cxibsvai6ka3ovmrt6wahq
This is a simple game. It's only purpose is to print which questplatform
is being used.
Click this "details" for the code:
<!--Saved by Quest 5.8.7753.35184-->
<asl version="580">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="What Platform?">
<gameid>52403648-3a37-4c2c-ac9b-a8e42eabf996</gameid>
<version>1.0</version>
<firstpublished>2021</firstpublished>
<changedquestplatform type="script">
msg ("")
msg ("[THIS GAME IS BEING PLAYED ON {=UCase(game.questplatform)}.]")
msg ("")
</changedquestplatform>
</game>
<object name="room">
<inherit name="editor_room" />
<isroom />
<description type="script">
firsttime {
JS.whereAmI ()
}
msg ("A small, nondescript room.")
</description>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
</asl>
Click this "details" to see screenshots:
DESKTOP - Running in Quest 5
DESKTOP (ALT) - Playing online.
MOBILE - Chrome on Android
MOBILE - Firefox on Android
I don't know exactly how it works, but it seems that something isn't forwarding something to "mobile" in Firefox on Android.
I notice the address in Chrome on Android is "/mobile/Play.aspx", and FIrefox on Android is just "/Play.aspx".
I also know that there are 3 different JS files in Quest. One is in the desktop installation, and it sets platform
to "desktop"
when that file loads. The second is in the web player's files, and it sets platform
to "webplayer"
when it is loaded. The third is in the mobile directory in the web player's files, and it sets platform
to "mobile"
when loaded.
So, whatever is going on in Firefox on Android is messing up any games in which we use JS.whereAmI()
and game.questplatform
.
I am pretty sure it isn't anything to do with Quest's code, unless 51Degrees is the culprit -- and that is just an extremely wild guess as to what could be the issue.
https://docs.textadventures.co.uk/quest/js/whereami
https://github.com/textadventures/quest/search?q=mobile
mrangel
23 May 2021, 20:52I don't know exactly how it works, but it seems that something isn't forwarding something to "mobile" in Firefox on Android.
It could be that the browser is declaring itself to be the desktop version. I've seen firefox mobile before failing to display the mobile version of sites, which is one reason I decided against using it. If the browser isn't giving the server the usual hints to know what kind of device it is, there's probably very little Quest can do about it.
Although I do think that some of the mobile layout features (like the sidebar) should be determined in JS based on the screen size, not the device type.
K.V.
23 May 2021, 21:00I tried going into settings and toggling Desktop View on and off, and it didn't change anything.
I didn't know Firefox had this issue in general, but I was thinking it was probably just something to do with Mozilla's code.
My next thought was that Firefox usually has issues Chrome doesn't because Firefox gets new features sooner. (Google is smart and lets Mozilla work the bugs out first, I guess.) That led to me remembering GitHub complaining about old versions of stuff like 51Degrees. (I don't know that 51Degrees actually is one of those warnings, though.)
Mostly, though, I just figured people with code in their games to handle mobile differently would like to know that Firefox has a monkey wrench and throws it at Quest games.
K.V.
23 May 2021, 21:03Although I do think that some of the mobile layout features (like the sidebar) should be determined in JS based on the screen size, not the device type.
With the phone vertical, there are no panes in Firefox. It only shows them when I rotate the phone so it's horizontal. (The screen shot is horizontal (of course)).
K.V.
25 May 2021, 21:26It looks like we can check for "Android" in navigator.appVersion
or navigator.userAgent
. If it is there, we go with "Plan Mobile"!
JS.eval ("var txt = \"\";txt += \"<p>Browser CodeName: \" + navigator.appCodeName + \"</p>\";txt += \"<p>Browser Name: \" + navigator.appName + \"</p>\";txt += \"<p>Browser Version: \" + navigator.appVersion + \"</p>\";txt += \"<p>Cookies Enabled: \" + navigator.cookieEnabled + \"</p>\";txt += \"<p>Browser Language: \" + navigator.language + \"</p>\";txt += \"<p>Browser Online: \" + navigator.onLine + \"</p>\";txt += \"<p>Platform: \" + navigator.platform + \"</p>\";txt += \"<p>User-agent header: \" + navigator.userAgent + \"</p>\"; addText(txt);")
Quest Desktop (Windows 10)
Firefox Desktop Browser (Windows 10)
Firefox on Android

Chrome on Android

K.V.
25 May 2021, 21:28Someone with an iDevice, please tell us what those bits are ("browser version" and "user-agent header"):
https://play2.textadventures.co.uk/Play.aspx?id=dtpgq8gawuovpb6oagadsg
K.V.
26 May 2021, 18:44JS.eval ("if(navigator.userAgent.toLowerCase().indexOf('mobile') > -1){platform = 'mobile';whereAmI();}")
That seems to catch it.
Stick it in game.inituserinterface
.
mrangel
26 May 2021, 19:09I'd be cautious about doing that.
I guess it depends what you're using the platform
for, because then you'll have the platform set to mobile, but not have playermobile.js
loaded; and the page HTML will be from playercore.htm
rather than Mobile/Play.aspx
.
K.V.
26 May 2021, 20:13I think the only thing platform
is used for is whereAmI(), which is only there for us to check which type of browser/device is being used from inside the game's code. It sets game.questplatform
, and that doesn't effect anything unless we add code to do something with it.
...and I think 51Degrees is what decides whether or not the mobile files should be loaded *.
I am not sure enough about either of those to bet any money on it, though.
EDIT
You are 100% correct, though.
In my case (in this particular instance), I'm just ending the game if I find out it's loaded on a mobile device, but most of time I would be modifying behavior to suit mobile browser capabilities, and chaos would probably ensue were I to assume the mobile stuff was loaded when it wasn't.
K.V.
26 May 2021, 20:25This seems more safe:
<function name="FirefoxMobileDetector" parameters="unused">
// DO STUFF!
game.suppressturnscripts = true
</function>
ADD TO game.inituserinterface
:
JS.eval ("if(navigator.userAgent.toLowerCase().indexOf('mobile') > -1){if (platform != 'mobile'){ASLEvent('FirefoxMobileDetector','');}}")