How do I detect what browser the user is using?

0 favourites
  • 13 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hi Guys

    any suggestions on how to detect what browser the user is using (on laptop/computer)?

    Thanks you

  • What do you need this for? Generally you should avoid it. What usually happens is people write code that only works in certain browsers, then the browser makers realise websites are broken in their browser, so they make their browser pretend to be a different browser to fix it. This has happened so much that basically all browsers pretend to be a series of other current and past browsers.

  • Ashley--it's an honour dude.

    OK so the browser recognition was my solution to the below.

    I can't figure out how to get construct to recognise when an embedded video ends and so I decided to go with Webm video medium in order to easily be able to control actions directly after video finishes. However I believe that the webm format is not going to be widely compatible.

    Ultimately I've got to much video to include it in a project so a little buggered right now..

  • Or maybe there's a way of downloading more vodeo files to the project later when the user needs it...?

  • I'm still not sure what you're trying to do or why you think you need to detect the browser to solve it. The format of the video should not have any effect on your ability to identify when it ends.

  • I'm assuming Kelvin is using WebM for its superior file size, and that any alternatives are simply too big.

    WebGL2 has weaker support than WebM, so I'd use it with impunity, as if the browser doesn't support WebM, it probably wouldn't support C3 to begin with

    EDIT//

    You might want to look into the iframe plugin and YouTube for streaming video through your game

  • Ashley- the iframe plug in has no way of recognising when an embedded video has finished playing i.e on video finished > action. Using the video plug in works perfectly for what I need however I have many videos that I would need to import into the project hence Webm due to filesize and having a popup tell users to use Chrome browser instead (to ensure compatability).

    This is why I also wondered if there is a way to download videos to the webapp during use and not just when you initially load the page.

    Elliot- I'm fairly new to all this so this helps.

    Ultimately, my whole problem is solved by the iframe being able to recognise when an embedded video finishes playing.

    Thanks guys

  • Well for example I need to make sure user is using Chrome because I am using speech recognition.

    Otherwise I need to inform the user to change the browser. How can I check what browser the user is using in C3 ?

  • You should be calling "Supports speech recognition".

  • Hi blackhornet I am doing this. It works in Chrome (supports) and FF(does not support) somehow not working in Opera. I mean it should show warning on Opera but its not...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Then you should report this as a bug.

  • You should always use feature detection (in this case "is speech recognition supported") instead of browser detection. If you only enable a feature in one browser, you will needlessly block it from working in other browsers, including if other browsers add support for it in future.

  • I do use it, and when its not supported I want to show warning.

    It doesn't work in Opera, apparently it thinks that Opera has speech recognition.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)