Skip to main content
Inspiring
Jan 28, 2017 8:53 PM UTC
Question

cpInfoMobileOS

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 is closed to new replies. Start a new post to keep the conversation going.

    7 replies

    TLCMediaDesign
    Inspiring
    Jan 30, 2017 10:50 AM UTC

    You cannot put the method in quotes:

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

    Translate
    Inspiring
    Jan 31, 2017 2:54 AM UTC

    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!

    Translate
    RodWard
    Community Expert
    Community Expert
    Jan 31, 2017 3:15 AM UTC

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

    Translate
    TLCMediaDesign
    Inspiring
    Jan 29, 2017 11:59 AM UTC

    I use the following JavaScript function:

    cp.CPAPIInterfaceClass.prototype.getCurrentDeviceMode()

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

    Translate
    Inspiring
    Jan 30, 2017 3:21 AM UTC

    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!

    Translate