My html page url is www.example.com/training/product.html. I want to change my url like to www.example.com/training/product. Is it possible using javascript or Jquery? How?
Sorry I can not comment due to Reputation-Restriction.
The right solution is not yet in the comments.
window.history.replaceState()
does the job.
I would do:
var link = 'www.example.com/training/product.html';
link.split('.html')[0];
window.history.replaceState( null, null, link );
For a more respected solution go to How to reliably get the filename without the suffix in javascript?
https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history#The_replaceState().C2.A0method
You can do that by using MVC. This can not be done by Javascript. This needs to be done on server side.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With