Skip to main content
DMax6_6
Participant
November 18, 2017
Question

How to jump to a specific slide when opening one project from another with URL

  • November 18, 2017
  • 1 reply
  • 644 views

Hello

I know there was an old blog regarding this back in 2011 but it does not appear to be available anymore.  I know how to call one project from another using a URL, but I can not figure out how to tell the second project what slide to jump to.  Both projects are on a web server and have been built using Captivate 2017.  Any help would be hugely appreciated.

Here is some JavaScript that I have tried in an Advanced Action of the project I want to specify the slide jump in, called in the On Enter event of the first slide in that project, but it is not working.  The bolded section will not be taken by Captivate (the script won't save if that is included.)  Not a JS expert by at all so I am not sure what is wrong with that part.

window.getQueryParamValue = function (name) var q=document.location.search||document.location.hash; if(name==null){return q;}if(q) window.getQueryParamValue = function (name){ 

          var q=document.location.search||document.location.hash; 

          if(name==null){return q;}

          if(q) {var aryParams=q.substring(1).split("&"); for(var i=0;i<aryParams.length;i++) {if(aryParams.substring(0,aryParams.indexOf("="))==name) {return aryParams.substring((aryParams.indexOf("=")+1)); 

                              } 

                    } 

          }  

return "";} 

 

if(typeof window.cp === 'undefined'){ 

          var gotoSlideNumber = getQueryParamValue('cpCmndGotoSlide'); 

          if(gotoSlideNumber != '') { 

                    document.Captivate.cpEISetValue('m_VarHandle.cpCmndGotoSlide', gotoSlideNumber -1); 

          } 

}else{ 

          window.gotoSlideNumber = window.getQueryParamValue('cpCmndGotoSlide'); 

          if(window.gotoSlideNumber != '') { 

                    window.cpCmndGotoSlide = window.gotoSlideNumber -1; 

          } 

}

Thank you

D.

    This topic has been closed for replies.

    1 reply

    TLCMediaDesign
    Inspiring
    November 20, 2017

    It's as simple as appending a hash onto the URL you are calling:

    For example, to open the subsequent Captivate file and jump to slide 4 use:

    document.location ,href = 'index.html#3';

    Then on slide enter of the second file, execute this script:

    window.cpCmndGotoSlide = window.location.hash.substring(1, window.location.hash.length);