Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Re-write / Modify URL with javascript / Jquery after page load

Is it possible to re-write URL without reloading the page via jQuery/Javascript?

Let's say you have the following URL:

http://stackoverflow.com/questions/ask

can we append the value: /pId=XYZ

So you can get

http://stackoverflow.com/questions/ask/pId=XYZ

Is this possible?

like image 841
BJ Patel Avatar asked Dec 19 '25 18:12

BJ Patel


1 Answers

All you can change without redirecting is the hash part of url:

document.location.hash = "whatever";
like image 85
Michal Klouda Avatar answered Dec 21 '25 09:12

Michal Klouda



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!