Skip to main content
AskingAboutJS
Inspiring
October 28, 2016
Answered

Responsive and Non-Responsive Differences?

  • October 28, 2016
  • 2 replies
  • 1112 views

Captivate 9.0.0.223

I have a responsive project which uses JS and works fine. When I preview the project, I get the options:

- Play Slide

- From this Slide

- Next 5 Slides

- Project

- Preview in SCORM Cloud

- In Adobe Edge Inspect

I use "From this Slide" and the project (along with all the JS) works fine.

On my non-responsive project, I get these bonus options:

- In Browser

- HTML5 in Browser

However, when I choose "From this Slide", a box pops up telling me "JavaScript is executed at this point in the project. To preview, use a web browser."

Then I tried "In Browser", and nothing happens when I click the button with JS (exact same JS code as the working responsive project).

Then I tried "HTML5 in Browser", and the loading circle spins indefinitely.

Code:

window.cpAPIInterface.setVariableValue("Score", "0");

if (Math.floor(Math.random() * 2) < 1) {

    window.cpCmndGotoSlide = 3;

}

else {

    window.cpCmndGotoSlide = 4;

}

    This topic has been closed for replies.
    Correct answer AskingAboutJS

    I have solved the issue and it now works.

    Responsive projects use HTML5, whereas non-responsive projects do not.

    HTML5 uses the code: window.cpCmndGotoSlide = 3;

    HTML uses the code: window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 3);

    Being a non-responsive project let me preview the project in a HTML5 browser, but it didn't let me use JS with HTML5. (I think)

    2 replies

    AskingAboutJS
    AskingAboutJSAuthorCorrect answer
    Inspiring
    October 30, 2016

    I have solved the issue and it now works.

    Responsive projects use HTML5, whereas non-responsive projects do not.

    HTML5 uses the code: window.cpCmndGotoSlide = 3;

    HTML uses the code: window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 3);

    Being a non-responsive project let me preview the project in a HTML5 browser, but it didn't let me use JS with HTML5. (I think)

    RodWard
    Community Expert
    Community Expert
    October 30, 2016

    Not quite correct.

    HTML5 Responsive projects ALWAYS use HTML5.  Non-responsive projects can also be HTML5, but you can also choose to publish to other non-responsive outputs such as HTM/SWF, EXE, or PDF.

    You can use JS code in both responsive or non-responsive projects, and with either HTML5 or HTM/SWF projects.

    AskingAboutJS
    Inspiring
    October 30, 2016

    RodWard

    That's what I thought too, but it wasn't working when I just copied the JS over. The non-responsive project wouldn't let me use the HTML5 preview, because I didn't have the initialisation calls (I think that's what the error was). However, my responsive project didn't have those either.

    Would you happen to know why that is the case?

    Lilybiri
    Legend
    October 28, 2016

    This can be explained by the difference between output possibilities:

    • For responsive projects only HTML5 output is possible. Hence all preview options do use the Browser to show the preview.
    • For normal projects boht SWF and HTML5 output is available. The 'legacy' Preview methods (all except the F11 and F12) do use SWF, which is the reason why they do not use a browser. Only the two Browser preview methods use it, that is the reason why you have to use those in case of JS use.
    AskingAboutJS
    Inspiring
    October 29, 2016

    Thank you for the information.

    Would you happen to know the second problem by any chance?

    Lilybiri
    Legend
    October 29, 2016

    I don't understand wat you want to do with that JS at all. You have to give more details.  I see a random number between 0 and 2, which will navigate to two different slides depending on whether it is under or over 1, but what do you want with that first line? Is 'score' a user variable defined in Captivate, is that not a reserved keyword?