4

Some websites like https://featurepoints.com are using a technique in which the user opens a new page without any kind of refresh, the URL will be changed but there is no refresh or an ajax usage. What techniques are they using? Is it pushState?

War10ck
  • 12,387
  • 7
  • 41
  • 54
Bira
  • 43
  • 1
  • 1
  • 5
  • 3
    Yes, they usually use `History.pushState` or the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) more generally. It is common functionality in single-page applications (SPAs). Edit: Don't know why you tagged vue.js and jQuery, but the Vue Router supports using the History API: https://router.vuejs.org/guide/essentials/history-mode.html – Chris Yungmann Sep 22 '20 at 15:07
  • 2
    I removed the `jquery` and `vue.js` tags as they are irrelevant to this question. – War10ck Sep 22 '20 at 15:23
  • Thank you guys, then I will go for History.pushState. I was wondering how featurepoints runs fast. @GalaxyCat105 yes I suppose – Bira Sep 22 '20 at 18:25

1 Answers1

8

I think you might be looking for history.pushState

history.pushState([data], [title], [URL]);

Using your example of https://featurepoints.com/

history.pushState(null, 'FeaturePoints Login', 'https://featurepoints.com/login');

Source and more details https://css-tricks.com/using-the-html5-history-api/

Rowan
  • 179
  • 6