[SOLVED] Can I check if previous page in history = page-name="shop"?


#1

On my back link I would like to check if previous page is the start page with page-name=“shop”.
If it is then I would like to add data-force=“true” and data-reload=“true” to is, otherwise I would like to just slide back in history as normal. Is this possible?
Thanks.


#2

It’s posibble. There are many different solutons: router, events, page events, async, router beforeEnter and many other.


#3

You need to add custom click handler to “back” link and remove “back” class from it, and use router API. To know previous page name from current one:

var prevPageName = page.$el.prev('.page').attr('data-name');

#4

Thanks Vladimir, yes I got it working so I can go back to the page I want, depending on the previous page.