Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Clicking Anchor link, it gets appended in URL. How to stop it?

Avatar

Level 4

Hi,
I'm using anchor links in page for some purpose within it. But when anchor link is clicked, it gets appended to URL in browser.

Suppose anchor link is #tab1, when it is clicked #tab1 gets added to URL (?wcmmode=disabled#tab1) which I don't want.

Is there any way I can stop this from happening?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi @sesmic,

 

As it is a browser feature you need to override the default behavior through the script. You might check this as well.

https://stackoverflow.com/questions/17012592/keep-url-unaffected-when-anchor-link-is-clicked 

 

Hope this helps.

 

Regards,

Nitesh

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

Hi @sesmic,

 

As it is a browser feature you need to override the default behavior through the script. You might check this as well.

https://stackoverflow.com/questions/17012592/keep-url-unaffected-when-anchor-link-is-clicked 

 

Hope this helps.

 

Regards,

Nitesh

Avatar

Level 5

Hi@sesmic 

anchor tag ids from the url can be hidden/removed by multiple ways as follows.

 

1. javascript - capture anchor tag click event and replace the unwanted tags

Check this video#16 - Remove anchor link id tag and # on urls when loading a page - YouTube

(Reference How to hide anchor tag from URL using jQuery (deanha.com)

2. Using CSS - (Reference - html - How to hide an anchor tag by href #id using css - Stack Overflow)

 

 

 

Hope this helps

 

Thanks,

Chandra