user1409619
user1409619

Reputation: 3

The hash of id of an anchor link is to be replaced with a slash in URL

I am having a static website built in HTML5, and having the scrolling pages. The link to the pages is specified by the help of inline anchor tag, and with the help of an Id it scrolls to the particular div and the url changes. for eg mysite.com#section1 if I move to secion 1 div.

I want to replace this # to / in the url and the page should be scrolling as well.

Can anyone please help me in achieving this.

Thanks in advance :)

Upvotes: 0

Views: 769

Answers (2)

Raj Nathani
Raj Nathani

Reputation: 2845

Its great that you are using HTML5.
The goodies which this great 5th version of HTML has bestowed upon us include the History API
With this API you can change the page URL (within the same domain) without redirecting/reloading.
The function is pushState.

-Relfor

Upvotes: 1

Saurabh Chandra Patel
Saurabh Chandra Patel

Reputation: 13586

you can use jquery or js

 url = url.replace("#", "/");

Upvotes: 1

Related Questions