• Register
Welcome to the in5 Answer Exchange! This a place to get answers about in5 (InDesign to HTML5) and make requests.

A way to make a "back button"?

0 votes
Is there a way for my in5 html "webapps" that would allow a user to tap on a "back" button that would direct them back to whichever page they came from? This would be just like in Acrobat now, or in a regular browser that would return you to whatever page you were on (and not the previous sequential page from the InDesign document).
Currently, the only options through InDesign are first page, previous page, next page, or last page of document, but no back to the page I was just on.
Any help would be greatly appreciated.
asked May 1 in how_to by j8xman (290 points)
retagged May 2 by j8xman

1 Answer

0 votes
Best answer

InDesign doesn't have an option like this built in, but if you name the button in the Button & Forms panel, and apply the following code as a .js file (replacing btn_name with the name of your button) using the Resources section of the in5 dialog, it should work as you hope:

   if(nav.previousPageIndex === undefined) nav.previousPageIndex = 0;
   $('[name="btn_name"]').on(clickEv,function() { nav.to(nav.previousPageIndex+1); });
answered May 8 by justin (111,760 points)
selected 3 days ago by justin
I tried this but it takes me back to the index page each time. Have any advice?
Is this a single-file (index.html) Web App?
It must have been me. I believe we have it working now.
Glad to hear it! :-)