erikringsmuth / app-router

Router for Web Components
https://erikringsmuth.github.io/app-router/
MIT License
610 stars 83 forks source link

Navigating back with an app-routed app #65

Closed mesokalos closed 9 years ago

mesokalos commented 9 years ago

Is there a way to make it possible to hit the back button without the page being "Not found". Additionally is it possible to use app router in a way that allows one to go directly to another page besides the home page. for example, I was able to get http://mararenzsmith.com working well, but if you go to http://mararenzsmith.com/photography you get an error. Navigating through the navigation drawer to the photography link works great but can't seem to get it to work directly. Thank you!

tyler-dot-earth commented 9 years ago

This is a matter of server configuration, not app-router. Your server is looking for a corresponding '/photography' path, but there is none. There is only an root path (/, probably pointed at index.html) which contains a web page (the Polymer app).

The reason that navigation works through the drawer is because the browser never actually navigates (that is, never makes an HTTP GET request) to /photography -- it is manipulating the browser's history/state via an api. I.e. it's simply saying "now you're at /photography, but don't actually go there".

Does that make sense?

erikringsmuth commented 9 years ago

Yep, you'll either need to use hash links or history pushState(). http://erikringsmuth.github.io/app-router/#/#navigation

If you use pushState() it requires extra setup on your server to return index.html even when you navigate to /photography.

mesokalos commented 9 years ago

Thank you! That makes sense,