Cordova Slack Digest

Mon, 14 Sep 2020 08:24:41 GMT

User count: 4116

Join the conversation at slack.cordova.io

Channel #general (1 messages)


Sun, 13 Sep 2020 21:05:13 GMT

@osaintilien55 says

function setLastLocation() {         var lastLocation = window.location.pathname         localStorage.setItem('lastLocation', lastLocation)       }

Along with

function getLastLocation() {         let lastLocation = localStorage.getItem('lastLocation')         lastLocation = ../..${lastLocation}``         return lastLocation       }

<a href="javascript:getLastLocation()" class="close item item-1">     <i class="fas fa-arrow-left fa-2x" style="color: white"></i> </a>

Trying to make a back button for my books to navigate to the previous page but the href setup I have is not working the way I though it would. There are two ways to get to the books of my app. Through clicking on links from the search results or going to the books manually though the UI navigation. Depending upon which way the user gets to the books I would like the href to redirect accordingly. The setLastLocation() is set on all the links leading to the content while the getLastLocation() is set on the back button of the actual content. When I type in the path for href literally (../../tracts.html) it works but when I try to use the function in the href it doesn't work. Any suggestions?