Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Detect HTML5? — Gideros Forum

Detect HTML5?

bigtunacanbigtunacan Member
edited May 2016 in General questions
Is there a way to check that the application is running as an HTML5 export so I can conditionally execute a different branch of code?

I'm using the lfs and lsqlite3 plugins which appear to not be compatible with the HTML5 export; I think I could replace the functionally on the web application with some REST API calls, but need to be able to do some platform based conditional branching.
if platform == "HTML5" then
  -- call REST endpoint
else
  lfs = require('lfs')
  -- do some stuff against the local file system
end
would like to

Comments

  • hgy29hgy29 Maintainer
    You can use Application:getDeviceInfo for this. For HTML5, it will return "Web" as first entry.

    Likes: antix, simwhi

    +1 -1 (+2 / -0 )Share on Facebook
  • SinisterSoftSinisterSoft Maintainer
    Here is an example:
    device={application:getDeviceInfo()}
    print(device[1])
    print(device[2])
    print(device[3])
    print(device[4])
    if device[1]=="Windows" or device[1]=="Mac OS" then
    	pc=true
    elseif device[1]=="Web" then
    	web=true
    elseif device[1]=="Win32" then
    	win32=true
    elseif device[1]=="WinRT" then
    	winrt=true
    elseif device[1]=="Windows Phone" then
    	winrt=true
    	slow=true
    elseif device[1]=="Android" then
    	android=true
    	if device[3]=="Amazon" then
    		kindle=true
    		if sub(device[4],1,3)=="AFT" then
    			tv=true
    			if device[4]=="AFTM" then
    				slow=true
    			end
    		end
    	elseif device[3]=="OUYA" then
    		ouya=true
    		tv=true
    		slow=true
    	elseif device[3]=="Geniatech" then
    		tv=true
    		if sub(device[4],1,9)=="GameStick" then
    			gamestick=true
    			slow=true
    		end
    	elseif device[3]=="HardKernel Co., Ltd." then
    		tv=true
    		hardkernel=true
    		if device[4]=="ODROIDC" then
    			odroidc=true
    			slow=true
    		end
    	elseif device[4]=="Nexus Player" then
    		tv=true
    		nexusplayer=true
    	elseif device[3]=="razer" then
    		tv=true
    		razer=true
    		if device[4]=="Forge" then
    			forgetv=true
    		end
    	elseif device[3]=="IRIVER" then
    		slow=true
    	end
    elseif device[1]=="iOS" then
    	ios=true
    	if device[3]=="Apple TV" then
    		appletv=true
    	end
    end
    if application:isPlayerMode() then
    	secret=true
    end

    Likes: antix

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.