Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can turn on HTML5 History support in Spine like this:</p> <p><code>Spine.Route.setup(history: true)</code></p> <p>By passing the <code>history: true</code> argument to <code>Spine.Route.setup()</code> that will enable the fancy URLs without hash.</p> <p>The documentation for this is actually buried a bit, but it's here (second to last section): <a href="http://spinejs.com/docs/routing" rel="nofollow">http://spinejs.com/docs/routing</a></p> <p><strong>EDIT:</strong></p> <p>In order to have urls that can be navigated to directly, you will have to do this "server" side. For example, with Rails, you would have to build a way to take the parameter of the url (in this case "/users"), and pass it to Spine accordingly. Here is an excerpt from the Spine docs:</p> <blockquote> <p>However, there are some things you need to be aware of when using the History API. Firstly, every URL you send to navigate() needs to have a real HTML representation. Although the browser won't request the new URL at that point, it will be requested if the page is subsequently reloaded. In other words you can't make up arbitrary URLs, like you can with hash fragments; every URL passed to the API needs to exist. One way of implementing this is with server side support.</p> <p>When browsers request a URL (expecting a HTML response) you first make sure on server-side that the endpoint exists and is valid. Then you can just serve up the main application, which will read the URL, invoking the appropriate routes. For example, let's say your user navigates to <a href="http://example.com/users/1" rel="nofollow">http://example.com/users/1</a>. On the server-side, you check that the URL /users/1 is valid, and that the User record with an ID of 1 exists. Then you can go ahead and just serve up the JavaScript application.</p> <p>The caveat to this approach is that it doesn't give search engine crawlers any real content. If you want your application to be crawl-able, you'll have to detect crawler bot requests, and serve them a 'parallel universe of content'. That is beyond the scope of this documentation though.</p> </blockquote> <p>It's definitely a good bit of effort to get this working properly, but it CAN be done. It's not possible to give you a specific answer without knowing the stack you're working with.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload