Alpha DevCon 2018
Results 1 to 7 of 7

Thread: Here Is A Method To Fetch The Browser Type And Version ...

  1. #1
    "Certified" Alphaholic iRadiate's Avatar
    Real Name
    Stephen
    Join Date
    Jan 2011
    Location
    London, ON
    Posts
    1,438

    Default Here Is A Method To Fetch The Browser Type And Version ...

    I wanted to determine what browser the user is using because there can be problems with native mp4 video playback in browsers other than Internet Explorer.
    If I know what browser they are using, I can notify them that they cannot view the video if it's not IE. I still have this to sort out, but at least I can get the correct browser and version for now :)

    After researching this it turns out to be not as simple as it seems. However, I have found what I think to be a very simple solution and it seems to be working well.
    It uses a 3rd party javascript file called 'bowser.js' .. you can read about it here ... https://github.com/lancedikson/bowser
    I downloaded the entire package, but I think only the bowser.js file is needed for this. I've attached it here as well.

    Setup is simple:

    1. In the Web Projects Control Panel add the bowser.js file

    1. Javascript File.png

    2. In the UX Properties add bowser.js to the Javascript Linked Files

    2. Javascript Linked Files.png

    3. Call code to execute the javascript. In this test case I have the following code in the button OnClick event which puts the returned data into the control called Result.

    Code:
    {dialog.Object}.setValue('Result','Browser is '  + bowser.name + ' ' + bowser.version);

    Here is a video demonstrating the result: https://www.screencast.com/t/Rggr3ER9q
    The sample UX is also attached.
    Attached Files Attached Files
    Last edited by iRadiate; 12-29-2017 at 12:12 PM. Reason: grammar
    Alpha Anywhere v12.4.5.4.1 Build 5151-5127 IIS v8.5

  2. #2
    "Certified" Alphaholic peteconway's Avatar
    Real Name
    Peter Conway
    Join Date
    Oct 2005
    Location
    Melbourne, Australia
    Posts
    2,478

    Default Re: Here Is A Method To Fetch The Browser Type And Version ...

    Thanks for this - this is a very important thing to now as it allows us to avoid differences in browser issues we bump into from time-to-time. Well done.
    Insanity: doing the same thing over and over again and expecting different results.
    Albert Einstein, (attributed)
    US (German-born) physicist (1879 - 1955)

  3. #3
    Member
    Real Name
    Michael Cornford
    Join Date
    Oct 2011
    Location
    East Sussex, UK
    Posts
    884

    Default Re: Here Is A Method To Fetch The Browser Type And Version ...

    Thanks.

  4. #4
    Member
    Real Name
    Ben Sacherich
    Join Date
    Mar 2014
    Location
    Pittsburgh, PA
    Posts
    94

    Default Re: Here Is A Method To Fetch The Browser Type And Version ...

    Good stuff Stephen. Thanks for providing the various ways of explaining it. :)

  5. #5
    Member jgrannis's Avatar
    Real Name
    Jeff Grannis
    Join Date
    Apr 2016
    Location
    New Iberia, LA
    Posts
    207

    Default Re: Here Is A Method To Fetch The Browser Type And Version ...

    You can basically get all the browser information with simply:
    navigator.userAgent

    Code:
    alert('navigator.userAgent: '+navigator.userAgent);
    And in a5.js, they have helped with creating a bunch of flags concerning the userAgent.
    For instance:
    A5.flags.isMobile
    A5.flags.isWebKit
    A5.flags.isOpera
    A5.flags.isFireFox
    A5.flags.isIE
    A5.flags.isWindows
    A5.flags.isIPhone
    A5.flags.isIPad
    A5.flags.isXoom
    A5.flags.isKindle
    A5.flags.isPlaybook
    A5.flags.isGalaxy
    A5.flags.isTouchPad
    A5.flags.isAndroid
    A5.flags.isNotWebKit

  6. #6
    "Certified" Alphaholic iRadiate's Avatar
    Real Name
    Stephen
    Join Date
    Jan 2011
    Location
    London, ON
    Posts
    1,438

    Default Re: Here Is A Method To Fetch The Browser Type And Version ...

    Well, when you google this, what I found was that getting browser information using js navigator can often produce misleading information and should not be used.
    That's why I said in my first post that it is not as simple as first seems, and it's why I didn't choose to use it.

    This is a direct quote from W3Schools:
    Warning !!!

    The information from the navigator object can often be misleading, and should not be used to detect browser versions because:

    Different browsers can use the same name
    The navigator data can be changed by the browser owner
    Some browsers misidentify themselves to bypass site tests
    Browsers cannot report new operating systems, released later than the browser
    I don't know if Alpha internally manages these hurdles or not. Maybe it's fine. Maybe not.
    Alpha Anywhere v12.4.5.4.1 Build 5151-5127 IIS v8.5

  7. #7
    Member
    Real Name
    Richard Battle
    Join Date
    May 2017
    Location
    Austin,TX
    Posts
    87

    Default Re: Here Is A Method To Fetch The Browser Type And Version ...

    Your post are always good man.

Similar Threads

  1. Browser version requirements
    By noviceuser in forum Application Server Version 11 - Web/Browser Applications
    Replies: 2
    Last Post: 12-26-2013, 07:54 PM
  2. Detecting user browser type
    By mikeallenbrown in forum Mobile & Browser Applications
    Replies: 4
    Last Post: 10-17-2013, 02:17 PM
  3. ORA-24374: define not done before fetch or execute and fetch
    By jrturner0112 in forum Application Server Version 11 - Web/Browser Applications
    Replies: 2
    Last Post: 12-19-2012, 12:28 PM
  4. incorrect data type, method not found errors
    By W. Horton in forum Alpha Five Version 4
    Replies: 3
    Last Post: 10-29-2002, 04:49 PM
  5. return type of a method
    By Rick LaCount in forum Alpha Five Version 4
    Replies: 8
    Last Post: 10-19-2000, 06:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •