How to automatically replace `url` in browser address bar with JavaScript: from /en/services/ to /en/#services? -
Automatically change url in the browser address bar javascript With <& Nbsp; From company.com/en/ services /
& nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; Company.com & nbsp; / I / #services
?
Example: When I type the browser address bar URL company.com/en/services/ and click on 'Go', it will automatically see company.com/en/#services
Is there any way to replace with the real URL / services / hash URL / # services without browser refresh and there is no redirection? What is some solution for jQuery?
You can not change the URL with the javascript for the current page. You can only change the hash like this (without refreshing):
window.location.hash = '#services'; So when you are on the page company.com/en / and click some, you can set the window.location.hash Can . For example, it can be changed to company.com/en/#anything_you_set , and suggested it is the only way to reload the page.
If you want to type the URL and convert it to hash, you will see (at least) ASP.NET and IIS for viewing. If you are on IIS7, you can You can use it.
If you are on Apache, you can read
Comments
Post a Comment