Curious question - altering URL

Hello, everyone,

I just now noticed that as I scroll down posts of a particular topic, the URL in my browser is being updated with the post number that is in view.

I was always of the understanding that the URL couldn’t be directly manipulated in the URL field of the browser, as this was a security issue. Yet, here SPF is doing just that.

Is this a new declaration of the HTML5 standards??? And how is it done? I’m curious.

V/r,

:slight_smile:

HTML5 would be my guess.

https://html.spec.whatwg.org/multipage/browsers.html#history

Look at location interface - might be what discourse is using.

That seems right. I believe Discourse does use history.pushState, but maybe @system can shed some light on the topic.

1 Like

FINALLY, a page DoD isn’t blocking… :slight_smile: Thanks!

V/r,

:slight_smile:

1 Like

It’s done using HTML5’s history API
Here’s alink explaining more (sorry, I’m on an iPad)

http://stackoverflow.com/questions/3338642/updating-address-bar-with-new-url-without-hash-or-reloading-the-page

That is pretty slick. Thanks for the link, @Pullo.

V/r,

:slight_smile:

UPDATE: The API can be read about here.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.