Jump to content

Does Current PixiJSv4 Have Function To Detect Platform?


JeZxLee
 Share

Recommended Posts

Hi,

Simple question:
Does current PixiJSv4 have function to detect platform?
(like if game is being played on Wndows, Linux, or Android)

I want to fill entire screen only on mobile Android and not on desktops/notebooks...

Let me know, thanks!

JeZxLee

Link to comment
Share on other sites

Hi,

I tried this code but it does not detect when game is played on Android?

if ( navigator.userAgent.toLowerCase().indexOf('android') > -1 )
    Browser = "Android";
else  Browser = "Other";

 

Link to comment
Share on other sites

Found this on the web:

if (  (typeof window.orientation !== "undefined") || ( navigator.userAgent.indexOf('IEMobile') !== -1 )  )  isMobile = true;

Worked on my Android phone and tablet.

JeZxLee

Link to comment
Share on other sites

13 hours ago, JeZxLee said:

Found this on the web:


if (  (typeof window.orientation !== "undefined") || ( navigator.userAgent.indexOf('IEMobile') !== -1 )  )  isMobile = true;

Worked on my Android phone and tablet.

Yep, platform detection is always one of those things, "it works today", no guarantee it'll work tomorrow and you really don't want to keep a matrix of detection up to date, not to mention that whatever you are expecting on that platform could change (depending on what you want to do of course). See if you can find a library that can handle this, one with enough resources working on it to keep it up to date. Although far better is feature detection, as that is about as future-proof as you get with JS.

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...