Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6587251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:53:38+00:00 2026-05-25T16:53:38+00:00

We are working on a project using window.history.replacestate. Unfortunately we aren’t very good at

  • 0

We are working on a project using window.history.replacestate. Unfortunately we aren’t very good at javascript.

Essentially we are using it to replace any number of shortlinks to the ‘root’ link. For example :

domain.com/fJfk8
domain.com/9dkDl
domain.com/fjgdD

would all ‘appear’ as :

domain.com/nice_url

It doesn’t have to work so we’ll put the javascript in the page and in the browsers it does then great and if it doesn’t, they get the shortcode.

Note : we don’t want history !

So we are just using :

window.history.replaceState('Object','Nice URL Title', '/nice_url');

The question is that this appears to work but we don’t understand the ‘Object’ (data) part.

What exactly is it ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:53:39+00:00Added an answer on May 25, 2026 at 4:53 pm

    You can set the Object parameter to arbritary data, which will be available in the state parameter of the event object which is available in the popstate event.

    In other words, you can set it to whatever you want, to help you restore the webpage to the desired state when the user navigates through their history.

    For more information, see the MDC documentation on window.history.

    window.history.replaceState({
        foo: 'bar'
    }, 'Nice URL Title', '/nice_url');
    
    window.onpopstate = function (e) {
        if (typeof e.state == "object" && e.state.foo == "bar") {
            alert("Blah blah blah");
        }
    };
    
    window.history.go(-1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a project using Python and pyGTK. I have a window whose
I am working on one project and I am using JavaScript code to get
I had implemented facebook login in my project using javascript code. It was working
Working on a project using Entity Framework (4.3.1.0). I'm trying to figure out how
I am working on a project using Groovy, and I would like to take
I'm working on a project using Scala running Selenium tests as part of a
My team working in a project using Winforms application(c#) & MSSQL 2005 as database.
I am working on a project using the Orb feature detector in OpenCV 2.3.1
I'm currently working on a project using netbeans 6.9 and grails 1.3. I'm trying
I am a Java programmer and was working on a project using Hibernate and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.