Clarity Service Management

Expand all | Collapse all

Capture browser type within Script box on Catalog form

Jump to Best Answer
  • 1.  Capture browser type within Script box on Catalog form

    Posted 02-22-2019 03:55 PM

    I'm trying to use JavaScript within the the script box on a catalog form to capture the browser type of the user. 

     

    I found this simple little code snippet  that successfully alerts the browser type when executed in chrome's console, but I haven't been able to figure out how to get it to work in the context of a catalog script box.

     

    var browser_type = Object.keys($.browser)[0];
    alert(browser_type);

     

    I've tried various combinations of the $() basic syntax that catalog uses and a few JSON methods but the only results I've gotten have been either [object Object] or nothing at all.

     

    Any ideas or knowledge on the subject would be appreciated!



  • 2.  Re: Capture browser type within Script box on Catalog form
    Best Answer

    Posted 02-25-2019 04:40 AM

    Good Morning Elwynn.

    I created the below script on a form within CA Service Catalog(SC).
    {
    onload : function()
    {
    var browser_type = Object.keys($.browser)[0];
    alert(browser_type);
    }
    }

    And on the form's attribute name 'onLoad', I entered value: 'ca_fd.js.onload();'
    Save the changes to the form.

    Open a request for a service option with this form.
    And when the form gets loaded, I get a popup, reading 'webkit'.

    Perhaps this will get you starting/further?

    Kind regards, Louis.



  • 3.  Re: Capture browser type within Script box on Catalog form

    Posted 02-25-2019 07:59 AM

    Good morning Louis,

     

    I tried this in a 14.1 env. just now and got the same result you did.

    I was working in a 17.1 env. without cum. 2 installed on the 22nd when I posted the question, apparently just another bug in 17.1 

     

    I guess i'll have to either find another way to capture the data or wait till we patch the 17.1 envs.

     

    Thanks for your help!

     

    Elwynn.



  • 4.  Re: Capture browser type within Script box on Catalog form

    Posted 02-25-2019 08:59 AM

    Good Morning Elwynn.

     

    You'r welcome. Have a nice day..  Louis.