Get a Jumpstart with our Sample Apps
Results 1 to 6 of 6

Thread: Show-Hide Expression Based On Browser?

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

    Default Show-Hide Expression Based On Browser?

    Is there a show-hide expression that can be used to show or hide a static text control in a UX control?

    For example, if the user is using IE .. show the control but if the user is using Firefox .. hide the control.

    Would I need to determine the browser at login then set a session variable and use that in the expression?
    Alpha Anywhere v12.4.5.2 Build 4770-5018 IIS v8.5

  2. #2
    Member
    Real Name
    Alex
    Join Date
    Oct 2015
    Location
    Perth, WA Australia
    Posts
    44

    Default Re: Show-Hide Expression Based On Browser?

    You can do this client side

    //Put this in your javascript functions section
    var browser = (function(){
    var ua= navigator.userAgent, tem,
    M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
    if(/trident/i.test(M[1])){
    tem= /\brv[ :]+(\d+)/g.exec(ua) || [];
    return 'IE '+(tem[1] || '');
    }
    if(M[1]=== 'Chrome'){
    tem= ua.match(/\b(OPR|Edge)\/(\d+)/);
    if(tem!= null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
    }
    M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
    if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
    return M.join(' ');
    })();

    // Put the following in the OninitializeComplete event in Clientevents
    if (browser == 'Chrome 63') {
    var ele = $('DIVID');
    A5.u.element.show(ele,{type: 'none',duration: 'slow'} );
    } else {
    var ele = $('DIVID');
    A5.u.element.hide(ele,{type: 'none',duration: 'slow'} );
    }
    Alex Collier

    "Give a man a fish and you will feed him for a day; teach a man to fish and he will eat forever."

    Version 12.4.5.2 Build 4770 >> Deploying to IIS 8.5 on Windows 2012 R2 Server in AWS

  3. #3
    Member
    Real Name
    Alex
    Join Date
    Oct 2015
    Location
    Perth, WA Australia
    Posts
    44

    Default Re: Show-Hide Expression Based On Browser?

    Another Post that might be of use for determining Browser

    https://www.alphasoftware.com/alphaf...pe-And-Version
    Alex Collier

    "Give a man a fish and you will feed him for a day; teach a man to fish and he will eat forever."

    Version 12.4.5.2 Build 4770 >> Deploying to IIS 8.5 on Windows 2012 R2 Server in AWS

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

    Default Re: Show-Hide Expression Based On Browser?

    Quote Originally Posted by alexc View Post
    Another Post that might be of use for determining Browser

    https://www.alphasoftware.com/alphaf...pe-And-Version
    Um, well yes that's my post.

    I have it working now based on the method in my other post, thanks.
    Last edited by iRadiate; 01-06-2018 at 05:22 PM.
    Alpha Anywhere v12.4.5.2 Build 4770-5018 IIS v8.5

  5. #5
    Member
    Real Name
    Alex
    Join Date
    Oct 2015
    Location
    Perth, WA Australia
    Posts
    44

    Default Re: Show-Hide Expression Based On Browser?

    haha so it was. Awesome !
    Alex Collier

    "Give a man a fish and you will feed him for a day; teach a man to fish and he will eat forever."

    Version 12.4.5.2 Build 4770 >> Deploying to IIS 8.5 on Windows 2012 R2 Server in AWS

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

    Default Re: Show-Hide Expression Based On Browser?

    I should have come back to this post and added that link.

    But for anyone else searching this topic .. see Alex's reply #3 above for another possible answer.
    Alpha Anywhere v12.4.5.2 Build 4770-5018 IIS v8.5

Similar Threads

  1. Show/hide expression based on datetime field
    By mikeallenbrown in forum Mobile & Browser Applications
    Replies: 1
    Last Post: 02-07-2016, 09:35 PM
  2. Show/Hide Expression based on Blank Field?
    By Rich Hartnett in forum Mobile & Browser Applications
    Replies: 7
    Last Post: 12-30-2014, 04:33 PM
  3. client side show/hide expression to show object when row is dirty
    By Selwyn Rabins in forum Application Server Version 10 - Web/Browser Applications
    Replies: 3
    Last Post: 10-22-2012, 01:41 PM
  4. Show/Hide expression does not work in browser
    By charlesLPC in forum Application Server Version 10 - Web/Browser Applications
    Replies: 1
    Last Post: 12-19-2011, 12:17 PM
  5. Hide Help Icon when expression is entered in show/hide property.
    By leetv in forum Application Server Version 10 - Web/Browser Applications
    Replies: 0
    Last Post: 05-31-2011, 01:26 PM

Posting Permissions

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