pushState breaks root url

I’ve got pushState set to true, and this allows me to use the back button correctly on Android and browsers. So far so good.

I set up my views:
var accountView = app.views.create(’#view-account’, {
url: ‘/login/’
});
var homeView = app.views.create(’#view-home’, {
url: ‘/home/’
mdSwipeBack: true,
pushState: true,
});

And my routes contains:
{
path: ‘/’,
url: ‘./index.html’,
name: ‘index’,
}, {
path: ‘/home/’,
componentUrl: ‘./pages/home.html’,
name: ‘home’,
},{
path: ‘/login/’,
componentUrl: ‘./pages/login.html’,
name: ‘login’,
}

From searching around it seems that its because the pushState overrides the url param and my index doesn’t actually have a page, it just has the navbar and panel data, with /home/ being my actual home.

I fixed this on my local machine with a hacky
on: {
pageBeforeIn: function (event, page) {
app.router.navigate(’/home/’);
},
}
on ‘/’ so that going to localhost:/ ends up taking me to /1#/home/ after a quick flash on the screen, however this hack isn’t great and doesn’t work on the test systems where it has a proxy pass from its port to host/pizza/. Going to that site with pushState on brings the 404 page, which can then take you to home by selecting the home button, but I’d rather not have to direct people to host/pizza/!#/home instead of host/pizza.

Any help appreciated as I’ve been searching for a solution to this for a few days now.

Hi,

check for pushStateRoot parameter.

Bálint

Thanks!

I’d actually already played with that, but was thinking I needed it to be /home/ or / as I was testing on the local system. Anyway, thanks :slight_smile:

The issue in correct pushStateRoot, try forum search, there were a plenty similar issues solved