Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create dynamically loaded pages URL?

I'm noticing many websites with this AJAX loaded URL structure "#!", like twitter: (https://twitter.com/#!/apolinariosteps) but I couldn't find it documented (I didn't know what to search)

I'm not really sure if that is the solution (but I still wanna know how to do this), what I want is that when I load some content with Jquery, this cause a URL change somehow so I could share the page with the specific content loaded link.

Thanks in advance

like image 859
steps Avatar asked May 03 '26 05:05

steps


1 Answers

The reload-less URL change exists natively in newer browsers through browser history object and can be easily polyfilled with balupton's history.js. The basic syntax will be history.pushState(stateObject, title, URL).

like image 63
devstruck Avatar answered May 05 '26 18:05

devstruck



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!