Cool, so if I've created a LocalStorage variable called termsAccepted under 'data mapping' view, can I then have an onClick event for the continueButton that runs:
Tiggr.setItem(termsAccepted, 1);
Cool, so if I've created a LocalStorage variable called termsAccepted under 'data mapping' view, can I then have an onClick event for the continueButton that runs:
Tiggr.setItem(termsAccepted, 1);
Yes, but you should create the Local Storage variable via Create Local Storage Variable action.
Of course, thank you. I'm having trouble with the home page, checking the variable. My code is:
var s = localStorage.getItem('termsAccepted');
if (s == null) {
navigate(terms);
}
else {
alert(s);
}
If I remove "navigate(terms);" and just put an alert there it seems to work OK. Do you know what I'm doing wrong?
There is a little abstraction on top of the pages. The pages are defined like this:
code
function pageItem(pageName, pageLocation) {
this.name = pageName;
this.location = pageLocation;
}
Tiggr.AppPages = [
new pageItem('mobilescreen1', 'screen-D443.html'), new pageItem('current', 'screen-D443.html')];
/code
You can see it from page source (look for page JS file). So, to navigate, you would need to create such JavaScript object.
Hi Max,
I'm sorry but I don't understand this. I don't even know how to find the page javascript file? I can only see what is available to me in the app builder tool.
Are you able to help me further? Where do I put my
var s = localStorage.getItem('termsAccepted');
if (s == null) {
navigate(terms);
}
or do I have to change it?
Thank you,
Jaimee
The page you pass to navigation has to be created like this:
code
new pageItem('mobilescreenX', 'screen-XXXX.html')
/code
You can use Firebug (or Google Chrome Development Tools) to view the generated page source. I'd need access to your project to help with navigation. Please share your project with a href="mailto:support@gotiggr.com" rel="nofollow"support@gotiggr.com/a
Hi Max,
I shared my project. The main screen is called home, which I want to load screen terms if the variable termsAccepted is null. I'm heading out for a few hours now, so wont be able to answer any questions. Any help with this is greatly appreciated!
Kind regards,
Jaimee
Try this:
code
var page = new pageItem('terms', 'screen-E71C.html');
navigate(page);
/code
That doesn't seem to work. Is it supposed to be like this:
var s = localStorage.getItem('termsAccepted');
var page = new pageItem('terms', 'screen-E71C.html');
if (s == null) {
navigate(page);
}
on Load on the home page?
Sorry, the navigate API is a little bit different:
code
var s = localStorage.getItem('termsAccepted');
if (s != 'yes') {
navigateTo('accept', 'ajax');
}
else {
navigateTo('page3', 'ajax');
}
/code