September 25, 2018
Navigation between two Captivate projects (stop a page from reloading?)
Comments
(2)
September 25, 2018
Navigation between two Captivate projects (stop a page from reloading?)
Newbie 5 posts
Followers: 0 people
(2)

I’m working in Captivate 2017 in a non-responsive project. I have multiple projects that I’d like to ‘link’ together, which I’ve been able to do using my custom next and back navigation buttons built in Adobe Animate. The code for loading up a new project looks like this –

window.parent.window.location.href(“https:/www.urlfornextpagehere/index.html”);

(If you know a better piece of code for doing this, please let me know, I’m new to javascript).

This works well for loading up the next project, however for going back to a previous project (the goal is for users to have complete navigational control going back and forth as much as they want), I’ve used the same method, but I want the “previous” course to open up to it’s last slide, so that it feels more fluid (even though the lack of autoplay allowed in browsers kind of kills the fluidity, not much I can do about that). So I’ve used a # at the end of the URL to identify when the users is clicking backwards in the project. Something like this –

window.parent.window.location.href(“https://www.urlforpreviouspagehere/index.html#load-stuff”);

Then on the first slide of the previous project I have some code –

function pageLoad(){

if (window.location.hash === “#load-stuff”) {

// jump to last slide

window.cpCmndGotoSlide = 21;

}

}

pageLoad();

This sends the user to the last slide. The issue now is that the #load-stuff is still on the end of the URL, so now if the user goes through the Table of Contents and navigates to the first slide of that project, they will be sent to the last slide of it instead.

I’ve tried clearing out the #load-stuff tag when reaching the last slide of the project, by adding this to the final slide –

function getRidHash(){

window.location.href = location.href.replace(location.hash, “”);

}

getRidHash();

Which does clear the tag, however, then the page reloads entirely without the tag and returns back to the first slide.

Is anyone familiar with a better method for accomplishing this? Or is there a way I can stop the page from refreshing after executing my code on the last slide?

I did try adding window.stop(); to my code, but then it doesn’t complete loading all the web objects I have on the slides (some web objects I just place on the first slide and then set to last for the rest of the project).

Any advice is much appreciated.

2 Comments
2018-09-26 13:33:47
2018-09-26 13:33:47

Have you considered using the Aggregator Project option?

https://helpx.adobe.com/captivate/using/combining-multiple-swf-files-aggregator.html

 

Attachment

Like
(1)
>
Todd Spargo
's comment
2018-09-28 22:38:03
2018-09-28 22:38:03
>
Todd Spargo
's comment

Thanks, Todd! I’ve never heard of that before, however I was able to solve my issue! Instead of worrying about getting rid of the hashtag on the end of my URL, I changed my function to also check for last slide visited and set that to check for 0 (the first slide). That way, the code won’t execute unless the last visited is the first slide, which doesn’t happen unless you reload the page/URL (at least I think that’s how it works?)

So now my function looks like this –

function pageLoad() {
if(window.location.hash===”#revisited” && cpInfoLastVisitedSlide == 0) {
window.cpCmndGotoSlide = 21; // this is the last slide in my project
} else if (window.location.href.indexOf(“#”) > -1 && cpInfoLastVisitedSlide == 0) {
var url = window.location.href;
var num = url.slice(-1);
window.cpCmndGotoSlide = num;
}
}

pageLoad();

 

There is some extra stuff in there now too, accounting for if a user is trying to navigate to a specific slide in a new project.

Like
(1)
Add Comment