Skip to main content
Inspiring
January 28, 2017
Question

cpInfoMobileOS

  • January 28, 2017
  • 2 replies
  • 735 views

Hi,

there is system variable in Captivate 9 called cpInfoMobileOS. The description of this variable is:

Returns the type of OS of the mobile device.

  • Desktop-0
  • iOS-1
  • Android-2

My question: If somebody uses a mobile device without iOS or Android - which value will be returned by cpInfoMobileOS in this case? (Maybe somebody could try - I only have an iOS device here.) Is it also 0, like for desktops?

Or is there any other method (JS or whatever) to detect whether the learner is using a mobile device (not necessarily iOS or Android)?

My courses are not responsive but sometimes it`s good to provide different content for mobile devices.

I`m using Captivate 9 (most recent version) and publish in HTML5.

Thank you very much in advance for your help!

    This topic has been closed for replies.

    2 replies

    TLCMediaDesign
    Inspiring
    January 30, 2017

    You cannot put the method in quotes:

    window.cpAPIInterface.setVariableValue("var_device",cp.CPAPIInterfaceClass.prototype.getCurrentDeviceMode());

    Inspiring
    January 31, 2017

    There is either some typo or I have a strange computer... Anyway, it doesn't work for me (with or without quotes). I don't know what's wrong.

    But thank you for helping me!

    RodWard
    Community Expert
    Community Expert
    January 31, 2017

    Upload your content to a web server and view it from a mobile device.  What happens then?

    TLCMediaDesign
    Inspiring
    January 29, 2017

    I use the following JavaScript function:

    cp.CPAPIInterfaceClass.prototype.getCurrentDeviceMode()

    It returns 'desktop', 'tablet' or 'mobile'

    Inspiring
    January 30, 2017

    Thank you very much for this hint!

    I have one question (which is probably a bit embarrassing): How can I populate a Captivate variable with the returned value of cp.CPAPIInterfaceClass.prototype.getCurrentDeviceMode() ?

    Say I have a Captivate variable with the name var_device. I tried it with JS as follows:

    window.cpAPIInterface.setVariableValue("var_device","cp.CPAPIInterfaceClass.prototype.getCurrentDeviceMode()");

    and some similar expressions. However it never worked. So I don`t know which is the correct expression. Thanks very much in advance for any help!