![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What exactly is the pushState state object in HTML?
Use the pushSate object to update the page when the user navigates back through history. Let us see an example to include the selected color that creates a history entry −
function display(color) { var myState = { selectedColor: color }, myTitle = "Page title", myPath = "/" + color; history.pushState(myState, myTitle, myPath ); };
Now we will use the popstate event to update the selected color −
$(window).on('popstate', function(event) { var myState = event.originalEvent.state; if (statemyState { selectColor( myState.selectedColor ); } });
Advertisements