You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.6 KiB
1.6 KiB
What is Push State?
Lesson Objectives
- Describe PushState
- Demonstrate a SPA that uses Push State
Describe PushState
- PushState allows JavaScript to alter the browser's history as if a user is clicking on links and loading brand new pages
- This gives the appearance of the user actually visiting new pages
- If the application is set up correctly, it allows deep linking so that users can bookmark and share links to specific aspects of an application as if it were a page itself
- The user can use the back/forward buttons of the browser to move back/forward through their history of the various states they've used of the application.
- Now it behaves just as if they were viewing multiple pages of a traditional site
Demonstrate a SPA that uses Push State
- Go to Google Maps
- Pan/zoom around
- Observe how the URL changes
- Copy the URL after it's changed
- Note what the map currently looks like
- Close the window
- Open a new window and paste the copied URL into the URL bar. Hit enter (duh)
- Note that the page has opened to show the map exactly as it was when we copied the URL
- Go to a public Trello
- Note the current URL
- Open a card by clicking on it
- Note how the URL has changed
- Copy the URL after it's changed
- Note which card has been opened
- Close the window
- Open a new window and paste the copied URL into the URL bar. Hit enter (duh)
- Note that the page has opened to show the card that was opened when we copied the URL